Claude Code with a pay-per-token API key
Claude Code connects to FlyRouter over the Anthropic protocol: set two environment variables in settings.json, the base URL and the key. Models are billed per token, with no subscription.
https://api.flyrouter.ai/v1
- Pay as you go, no monthly fee
- Credits never expire
- Card, Alipay or WeChat Pay
- OpenAI, Anthropic and Gemini protocols
Models and prices for Claude Code
Live prices next to official prices. Cache prices and the full list are on the pricing page.
Updated 2026-11-18 12:46 UTCBilling rules
| ModelUSD / 1M tokens | Cache read | Cache write | vs official | 24h availability | ||
|---|---|---|---|---|---|---|
| Claude Haiku 5.5 | 75% off | |||||
| Claude Opus 5.5 | 75% off | |||||
| Claude Sonnet 5.5 | 75% off | |||||
| Claude Fable 5.2 | 75% off | |||||
| Claude Fable 5.1 | 75% off | |||||
| Claude Fable 5 | 75% off | |||||
| Claude Opus 5 | 75% off | |||||
| Claude Sonnet 5 | 75% off |
Configure Claude Code
Edit the user settings file ~/.claude/settings.json (on Windows, %USERPROFILE%\.claude\settings.json), creating it if needed. Do not add /v1 to ANTHROPIC_BASE_URL. Getting this wrong is the most common cause of a 404.
- 1Sign up and top up
- 2Create an API key
- 3Point your Base URL at FlyRouter
{
"env": {
"ANTHROPIC_BASE_URL": "https://api.flyrouter.ai",
"ANTHROPIC_AUTH_TOKEN": "sk-...",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "claude-opus-5-5",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "claude-sonnet-5-5",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "claude-haiku-5-5"
}
}Related
Billing and top-ups
- You are billed for actual usage, priced in USD. There is no monthly fee and no minimum spend, and credits do not expire.
- Top up with a credit or debit card, Alipay or WeChat Pay. Your balance is credited immediately.
- Tokens served from the prompt cache are billed at the lower cache price. Requests that fail because of an upstream outage are not charged.
- Every call's model, token usage and charge is recorded in the console's usage log, so you can check them line by line.
- Unused balance can be refunded to the original payment method within 7 days of top-up; payment processing fees are deducted.
What to know before using a gateway
- FlyRouter is an independent API gateway. It is not affiliated with Anthropic or any other model provider.
- Your request content is sent to the upstream provider that supplies the model, which generates the response. This is true of any gateway, so check before handling sensitive data.
- The gateway forwards each request to the model ID you specify and never silently swaps in a different model.
- Prompts and completions are used only for routing, metering, billing, risk control and support. They are never used to train models.
- Each model's real success rate and latency over the last 24 hours are public on the status page.
FAQ
- Do I need a Claude subscription?
- No. Through FlyRouter, Claude Code is billed per token from your balance, with no monthly fee.
- Why do I get a 404 after configuring it?
- The most common cause is a /v1 at the end of ANTHROPIC_BASE_URL. The Anthropic protocol takes the bare origin, and the client adds the path itself.
- How do I pin a default model?
- Add ANTHROPIC_MODEL to the env block in settings.json and set it to a model ID. Model IDs must match the pricing page exactly.
- It still asks me to log in. Why?
- Make sure ANTHROPIC_AUTH_TOKEN is in the env block of ~/.claude/settings.json, not just exported in one terminal. If you previously logged in with a Claude account, run /logout in a session to clear the old login.