@mariozechner/pi-ai library which provides a unified interface to 22+ LLM providers and hundreds of models, with built-in cost tracking, streaming, and OAuth support.
Model Format
Models are specified as aprovider:model string:
provider:model-id, where provider is one of the supported providers and model-id is the model identifier within that provider.
Auto-Inference
If you omit the provider prefix, Polpo infers it from the model name:| Prefix | Inferred Provider |
|---|---|
claude- | anthropic |
gpt-, o1-, o3-, o4-, chatgpt-, codex- | openai |
gemini- | google |
mistral-, codestral-, devstral- | mistral |
llama-, llama3 | groq |
grok- | xai |
deepseek- | openrouter |
gpt-oss- | cerebras |
glm- | zai |
minimax- | minimax |
kimi- | kimi-coding |
amazon., us., eu. | amazon-bedrock |
hf: | huggingface |
big-pickle | opencode |
Model Resolution Order
Polpo resolves which model to use through a layered system. Each layer can override the one below it.For Agents
- Agent’s
modelfield in the config POLPO_MODELenvironment variable
For Polpo Itself
Polpo uses its own model for conversations (via/v1/chat/completions and TUI chat), plan generation, question detection, deadlock resolution, and escalation decisions:
settings.orchestratorModelinpolpo.jsonPOLPO_MODELenvironment variable
For the Judge
The assessment system’s LLM-as-Judge uses a separate model that can be overridden independently:For Escalation
When a task fails and escalates, the model can be upgraded for the retry:API Key Resolution
For each provider, Polpo resolves the API key with this priority:providersconfig inpolpo.json(supports${ENV_VAR}references)- Standard environment variable for the provider (e.g.
ANTHROPIC_API_KEY) - Stored OAuth profiles from
polpo auth login(with automatic token refresh)
"anthropic": "sk-..." sets just the API key. The object form adds baseUrl for custom endpoints.
OAuth Authentication
For 5 providers (Anthropic, OpenAI Codex, GitHub Copilot, Google Gemini CLI, Google Antigravity), you can use your existing subscription instead of provisioning a separate API key:~/.polpo/auth-profiles.json with automatic refresh. When you have multiple profiles for the same provider (e.g., personal + work accounts), Polpo rotates between them automatically — prioritizing OAuth over API keys and distributing usage evenly.
Full Authentication Guide
OAuth setup, profile rotation, billing disable, session stickiness, and the
/model command.API key validation happens at startup. Polpo checks that every model referenced by an agent, the orchestrator, and the judge has a corresponding API key or OAuth profile. Missing keys emit a warning but don’t block startup.
Mixing Providers
Each agent can use a completely different provider. A single plan can mix Anthropic, OpenAI, Google, and local models:Default Model
When no model is configured, Polpo will prompt you to configure one viapolpo setup. Set a model on your agents or use the POLPO_MODEL env var.