Skip to main content

Function: keyPoolStrategyFromEnv()

keyPoolStrategyFromEnv(providerId?): Pick<ApiKeyPoolConfig, "strategy">

Defined in: packages/agentos/src/core/providers/ApiKeyPool.ts:116

The pool strategy the environment asks for when a provider's config names none: AGENTOS_KEY_POOL_STRATEGY_<PROVIDER> (ANTHROPIC, OPENAI, GEMINI, OPENROUTER, REQUESTY, and GROQ, MISTRAL, TOGETHER, XAI and LITELLM, which send through an OpenAIProvider) for one provider, else AGENTOS_KEY_POOL_STRATEGY for every provider; ordered prefers the earliest usable key (a cost order: credited keys first, the paid key last), round-robin spreads load. A variable that names neither strategy is skipped, so a typo in a provider's own variable leaves the shared one in force, and logged once per value as key_pool.strategy_ignored, naming the variable and not what it holds.

Parameters​

providerId?​

string

Returns​

Pick<ApiKeyPoolConfig, "strategy">