PineRouterDocs
GuidesModelsAPI referenceApps

Claude Code

Run Anthropic's terminal coding agent on your key and our models.

Claude Code speaks Anthropic's Messages format, which we serve at https://pinerouter.ai/v1/messages. Any text model on the Models page can answer it.

1. Install

curl -fsSL https://claude.ai/install.sh | bash
irm https://claude.ai/install.ps1 | iex

Or with Node.js 18 or newer: npm install -g @anthropic-ai/claude-code.

2. Point it at us

Add this to ~/.claude/settings.json (create the file if it does not exist):

{
  "env": {
    "ANTHROPIC_BASE_URL": "https://pinerouter.ai",
    "ANTHROPIC_AUTH_TOKEN": "sk-...",
    "ANTHROPIC_MODEL": "gpt-5-2",
    "ANTHROPIC_DEFAULT_HAIKU_MODEL": "gemini-3-8-flash"
  }
}
VariableMeaning
ANTHROPIC_BASE_URLOur address, without /v1
ANTHROPIC_AUTH_TOKENYour API key
ANTHROPIC_MODELThe main model; any text model id from Models
ANTHROPIC_DEFAULT_HAIKU_MODELA fast, cheap model for background tasks

Or set the same variables in your shell for one session:

export ANTHROPIC_BASE_URL="https://pinerouter.ai"
export ANTHROPIC_AUTH_TOKEN="sk-..."
export ANTHROPIC_MODEL="gpt-5-2"

3. Run

cd your-project
claude

Type /status to check the address and model in use. Usage shows up under Usage logs.

Add our media models as tools

Claude Code can also generate images, video and audio through our MCP server:

claude mcp add --transport http ai https://pinerouter.ai/mcp --header "Authorization: Bearer sk-..."

See MCP.

Troubleshooting

  • 401: the key is wrong or turned off. Check ANTHROPIC_AUTH_TOKEN, and that no ANTHROPIC_API_KEY is set as well.
  • Model not found: use a model id exactly as listed on Models.
  • 403: your balance is too low, or the key may not use this model. See Wallet and API keys.