Anthropic builds the Claude model family. Claude excels at coding, multi-step reasoning, and long-context tasks — making it the most popular choice for Polpo agent workloads.
Setup
Get your API key from the Anthropic Console.
export ANTHROPIC_API_KEY=sk-ant-...
Config
{
"providers": {
"anthropic": "${ANTHROPIC_API_KEY}"
}
}
Or inline:
{
"providers": {
"anthropic": "sk-ant-..."
}
}
Use it
{
"agents": [
{ "name": "coder", "model": "anthropic:claude-sonnet-4-5-20250929" }
]
}
You can also write claude-sonnet-4-5-20250929 without the prefix — Polpo auto-infers anthropic from the claude- prefix.
Models
| Model | Best for | Context | Reasoning | Vision |
|---|
claude-opus-4-6 | Most capable — complex architecture, hard problems | 200K | Yes | Yes |
claude-sonnet-4-6 | Latest balanced model — fast, strong coding | 200K | Yes | Yes |
claude-sonnet-4-5-20250929 | Previous gen balanced — still excellent | 200K | Yes | Yes |
claude-haiku-4-5-20251001 | Fast and cheap — boilerplate, formatting, simple refactoring | 200K | Yes | Yes |
Also available: claude-opus-4-5, claude-opus-4-1, claude-sonnet-4-0, claude-3-7-sonnet-20250219, claude-3-5-sonnet-20241022, claude-3-5-haiku-20241022
Recommended default. Claude Sonnet 4.6 is the best starting point for most Polpo workloads. Use Opus for complex architecture tasks and Haiku for high-volume simple tasks.
Features
| Feature | Supported |
|---|
| Streaming | Yes |
| Tool use | Yes |
| Vision (images) | Yes |
| Extended thinking (reasoning) | Yes (all current models) |
| Prompt caching | Yes |
Prompt Caching
Anthropic supports prompt caching to reduce costs on repeated prompts. Polpo uses this automatically when available.
Cost savings from caching can be significant for agent workloads where the system prompt and tool definitions are sent with every request.
Pricing
| Model | Input (per 1M tokens) | Output (per 1M tokens) |
|---|
claude-opus-4-6 | $15.00 | $75.00 |
claude-sonnet-4-6 | $3.00 | $15.00 |
claude-sonnet-4-5-20250929 | $3.00 | $15.00 |
claude-haiku-4-5-20251001 | $0.80 | $4.00 |
Cached reads are 90% cheaper than regular input tokens.
Provider Details
| |
|---|
| Provider ID | anthropic |
| Env variable | ANTHROPIC_API_KEY |
| API type | Anthropic Messages API |
| Auto-infer prefix | claude- |
| Base URL override | Supported (for proxies) |
OAuth: Use Your Claude Subscription
If you have a Claude Pro or Max subscription, you can use it directly as an LLM provider — no separate API key or billing account needed. This is the fastest way to get started with Polpo if you already pay for Claude.
Supported Subscriptions
| Plan | Works | Notes |
|---|
| Claude Max | Yes | High rate limits, recommended |
| Claude Pro | Yes | Standard rate limits |
| Claude Free | No | Insufficient API access |
Login
polpo auth login anthropic
Anthropic uses an Auth Code + PKCE flow with manual code paste (no localhost callback required):
- Polpo prints a URL — open it in your browser
- Authorize with your Anthropic account
- The browser shows an authorization code in
code#state format
- Copy it and paste it back in the terminal
Logging in to Anthropic (Claude Pro/Max)...
Open this URL in your browser and paste the authorization code
https://console.anthropic.com/oauth/authorize?...
Paste the authorization code from the browser (format: code#state): abc123#xyz789
Login successful!
Profile saved as: anthropic:user@example.com
Stored in ~/.polpo/auth-profiles.json
Token Refresh
OAuth tokens expire. Polpo handles this automatically:
- Before each API call, Polpo checks if the token is expired
- If expired and a refresh token exists, it refreshes silently
- If no refresh token is available, the profile is skipped and Polpo falls back to other credentials
- Refreshed tokens are saved back to
~/.polpo/auth-profiles.json
Multiple Accounts & Profile Rotation
You can log in with multiple Anthropic accounts (e.g., personal + work). Each gets its own profile:
anthropic:user@personal.com
anthropic:user@work.com
Polpo automatically rotates between them:
- Oldest
lastUsed first — distributes usage evenly
- Skips profiles in cooldown — rate-limited profiles are deprioritized
- Skips billing-disabled profiles — depleted accounts are avoided for longer (5h → 10h → 20h → 24h cap)
Billing Disable
If your subscription quota is exceeded, the profile enters billing disable mode — a longer backoff than regular rate-limit cooldown:
| Consecutive failures | Disable period |
|---|
| 1st | 5 hours |
| 2nd | 10 hours |
| 3rd | 20 hours |
| 4th+ | 24 hours (cap) |
The counter resets after 24 hours without a billing failure. Other Anthropic profiles (or API keys) continue working normally.
Session Pinning
When you select a model and profile via /model, Polpo pins it to the session:
/model anthropic/claude-opus-4-6@anthropic:user@work.com
A user-pin is hard — if that profile fails, Polpo fails over to the next model in the fallback chain rather than silently rotating to a different credential. Reset with /model reset.
Resolution Order
1. polpo.json providers.anthropic.apiKey (config wins)
2. ANTHROPIC_API_KEY environment variable (env var)
3. Stored OAuth profiles (auto-refresh)
If an API key is configured, OAuth profiles are ignored for this provider.
For the full authentication system — all OAuth providers, CLI commands, profile rotation algorithm, and security details — see the Authentication guide.
Notes
- Anthropic models have the largest output token limits when extended thinking is enabled.
- For escalation,
claude-opus-4-6 is a natural upgrade from Sonnet — configure it as escalateModel in your retry policy.
- Claude Max gives higher rate limits than Claude Pro, making it the better choice for agent workloads with many parallel requests.