Claude Code API gateway

Claude Code API Gateway Setup with TeamoRouter

Configure Claude Code to use TeamoRouter's Anthropic-compatible gateway with a base URL, API key, model name, and concrete price anchors you can verify.

Last updated: 2026-05-31

What this setup does

Claude Code can run through an Anthropic-compatible API endpoint. TeamoRouter provides that endpoint so you can point Claude Code at one gateway, create one API key, and manage usage in one place.

This page is for users who already know why they want an API workflow. If you are still deciding between Claude subscriptions, direct provider APIs, and a gateway, start with the comparison notes below instead of copying commands blindly.

  • Anthropic-compatible base URL: https://api.teamorouter.com
  • API key source: the TeamoRouter dashboard API Keys page
  • Best fit: high-token coding agent work, shared model spend, and users who want pay-as-you-go billing

Concrete price anchor

Claude Code is expensive when it starts reading files, rewriting patches, explaining failures, and retrying tests. A small per-token difference becomes visible once the agent is doing real project work.

The examples below use the current live pricing-table display logic, with list price and TeamoRouter price shown per 1M input/output tokens.

  • Claude Sonnet 4.6: list $3/$15 per 1M input/output tokens, TeamoRouter $0.54/$2.7, about 82% lower.
  • Claude Opus 4.6: list $5/$25 per 1M input/output tokens, TeamoRouter $0.75/$3.75, about 85% lower.
  • GPT-5.5: list $5/$30 per 1M input/output tokens, TeamoRouter $0.5/$3, about 90% lower.
  • Gemini 3.1 Pro Preview: list $2/$12 per 1M input/output tokens, TeamoRouter $0.38/$2.28, about 81% lower.

macOS and Linux configuration

Open a terminal in the project where you use Claude Code. Export the gateway endpoint and your TeamoRouter API key before starting Claude Code.

Model names can change as new models are added. Use the model names shown in the live TeamoRouter dashboard or documentation when you configure production workflows.

  • export ANTHROPIC_BASE_URL=https://api.teamorouter.com
  • export ANTHROPIC_AUTH_TOKEN=<your TeamoRouter API Key>
  • export ANTHROPIC_MODEL=<the Claude model you want to use>

Windows PowerShell configuration

On Windows, set the same values with PowerShell environment variables. After a quick test, move the values into the shell profile or your preferred secret manager instead of pasting the API key repeatedly.

  • $env:ANTHROPIC_BASE_URL="https://api.teamorouter.com"
  • $env:ANTHROPIC_AUTH_TOKEN="<your TeamoRouter API Key>"
  • $env:ANTHROPIC_MODEL="<the Claude model you want to use>"

Common setup checks

If Claude Code fails before sending a model request, check your local installation and shell environment first. If the request reaches the API but fails, check API key validity, account balance, model name, and the base URL.

Do not treat account login issues, subscription limits, network failures, and API authentication as the same problem. Splitting them early makes troubleshooting much faster.

  • 401 or 403: check the API key and account balance first.
  • Model not found: confirm the exact model name in TeamoRouter.
  • Connection error: confirm the base URL is https://api.teamorouter.com.

FAQ

What API base URL should Claude Code use?

Use https://api.teamorouter.com as the Anthropic-compatible base URL, then provide your TeamoRouter API key through ANTHROPIC_AUTH_TOKEN.

Does this replace an Anthropic account or subscription?

No. This page describes an API gateway workflow for Claude Code. It does not bypass account rules, subscriptions, KYC, regional availability, or provider policies.

How much can the gateway change my Claude Code cost?

It depends on model choice and token volume. As a current price anchor, Claude Sonnet 4.6: list $3/$15 per 1M input/output tokens, TeamoRouter $0.54/$2.7, about 82% lower. Long-context coding-agent sessions are where this difference matters most.

Can I use the same TeamoRouter key with Codex?

Yes, TeamoRouter is designed for multiple coding agents. Claude Code uses the Anthropic-compatible endpoint, while OpenAI-compatible tools use the /v1 endpoint.

What should I check first when requests fail?

Check the environment variables in the current shell, then the API key, balance, model name, and base URL. These are more common than a broken Claude Code installation.

Next steps

Claude Code API Gateway Setup with TeamoRouter