Claude Code with a custom base URL
Set these four variables in your shell, or in the env block of ~/.claude/settings.json, and Claude Code runs on Claude models through your AIGROW key.
Already have a code? Redeem it on API access, then create a key.
Shell, before you start claude
export ANTHROPIC_BASE_URL="https://aigrow.gg"
export ANTHROPIC_AUTH_TOKEN="ag_your_key_here"
export ANTHROPIC_MODEL="claude-opus-5.5"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="claude-sonnet-5.5"Swap ag_your_key_here for a key from API access.
Where the setting lives
- macOS and Linux
~/.claude/settings.json- Windows
%USERPROFILE%\.claude\settings.json- One project only
.claude/settings.local.json- VS Code extension
claudeCode.environmentVariables
Or keep it in settings.json
Claude Code reads the env block of its settings file on every start, so the setup survives a new terminal. A value here wins over a shell export. Keep the key out of a project’s .claude/settings.json, which is meant to be committed.
{
"env": {
"ANTHROPIC_BASE_URL": "https://aigrow.gg",
"ANTHROPIC_AUTH_TOKEN": "ag_your_key_here",
"ANTHROPIC_MODEL": "claude-opus-5.5",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "claude-sonnet-5.5"
}
}Which model to use
Put the id in exactly as it is written here.
- Claude Opus 5.5
claude-opus-5.5 - ANTHROPIC_MODEL, the model you work with. The default in every block on this page. Context: 1,000,000 tokens.
- Claude Sonnet 5.5
claude-sonnet-5.5 - ANTHROPIC_DEFAULT_HAIKU_MODEL, for titles, summaries and other background calls. Claude Code sends those to a Haiku model by default, which the endpoint does not serve. As the main model it costs the least over a long session, because its cache reads are the cheapest here. Context: 1,000,000 tokens.
- Claude Fable 5.1
claude-fable-5.1 - Costs more per token than Opus. Compare the two on the coding leaderboard before you switch. Context: 1,000,000 tokens.
The price list has every id and its credit rate, Claude API pricing has the list prices, and the coding leaderboard compares the models on coding prompts.
Check that it works
First the key on its own, then Claude Code with it.
The key
Ask for the model list. It needs a valid key and costs nothing.
curl https://aigrow.gg/v1/models -H "Authorization: Bearer ag_your_key_here"{
"object": "list",
"data": [
{ "id": "claude-opus-5.5", "object": "model", ... },
{ "id": "claude-fable-5.1", "object": "model", ... },
{ "id": "gpt-6-astra", "object": "model", ... },
{ "id": "claude-sonnet-5.5", "object": "model", ... },
{ "id": "gpt-6.1-sol", "object": "model", ... },
{ "id": "grok-4.7", "object": "model", ... },
...
],
"has_more": false
}Claude Code
Run one prompt from the shell. Inside a session, /status shows the base URL and where the key came from.
claude -p "Reply with the word ready"readyWhen it fails
The Claude Code errors first, then the answers the endpoint gives any tool.
- 404 on every request
- The base URL ends in /v1. Claude Code adds /v1/messages itself, so ANTHROPIC_BASE_URL is https://aigrow.gg with nothing after it.
- 400 about an unknown field
- Set CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1 and start again. Claude Code then stops sending its experimental request fields.
- It asks you to approve an API key
- You set ANTHROPIC_API_KEY, which goes as an x-api-key header and needs your approval once. Approve it, or use ANTHROPIC_AUTH_TOKEN as in the block, which goes as a Bearer header with no prompt.
- It still uses your Claude login
- Run /status. If it shows no custom base URL, the variables did not reach Claude Code: export them in the shell you start claude from, or put them in the env block of settings.json.
- My tool says 401 or authentication error
- The key is missing or mistyped. Copy it again from API access on the dashboard, and make sure it is sent as the key, not as a model name. A revoked key fails the same way: create a new one and swap it in.
- I get 402 or a message about credit
- Your balance is empty. Open API access on the dashboard, redeem a code or buy another pack, and the next request goes through. Nothing else needs to change.
- It says 404 or Unknown model
- The model has to be one the endpoint serves, for example claude-opus-5.5. The provider’s own spellings work too (claude-opus-5-5, anthropic/claude-opus-5.5), but a dated id or any model outside the catalogue is rejected before the request is forwarded, and nothing is billed. Request GET /v1/models with your key for the live list, or read the ids on the price list.
- Requests are rejected with 429
- The endpoint’s capacity is shared by every buyer: about 20 requests a minute and 4 at once. Each 429 carries a retry-after header, and the OpenAI and Anthropic SDKs wait that long and retry on their own. In a loop of your own, wait the seconds it names or lower your concurrency.
- The model is unavailable right now
- A 404 that says the model is not available right now means it is briefly down at the upstream provider, not a problem with your key or balance. Retry in a moment or send the request to another model.
- I get a 502 or 503
- A transient upstream or configuration hiccup, not a charge against your balance. Retry the request; if it keeps failing, reach us through the store and we will look into it.
What does not work through AIGROW
GPT and Grok. Claude Code is made for Claude models, so set only Claude ids here and use one of the other tools on this page for the rest.
Remote Control and voice dictation. They need a Claude login and are off with a gateway key.
Context size for an id Claude Code does not recognise. It treats one as 200,000 tokens, so a session may compact sooner than the model needs.
Exact token counts before a request. The endpoint has no token counting route, so Claude Code estimates the size of a prompt itself.
Live web search inside the model. A web search tool sent with a request is answered from what the model already knows, with no live results. A tool that fetches pages on your own machine still works.
Any endpoint past these three: /v1/messages, /v1/chat/completions and /v1/models. The Responses API, embeddings and token counting answer 404.
Router fields such as models, route, provider and plugins. They are dropped, so a request always goes to the one model it names.
What a month of Claude Code costs
A developer working all day, with most of each request read back from the prompt cache, priced at the list rate and through credit. Change the model to compare.
Claude Opus 5.5, Coding agent: $214.20 a month at the list price, $100.80 through AIGROW credit, $113.40 less (53%).
Questions about Claude Code and a custom API
- Does Claude Code work with a custom base URL?
- Yes. Set ANTHROPIC_BASE_URL to https://aigrow.gg and ANTHROPIC_AUTH_TOKEN to your key, and Claude Code sends every request there instead of to Anthropic. The VS Code extension reads the same settings.
- Should ANTHROPIC_BASE_URL end in /v1?
- No. Claude Code adds /v1/messages itself, so the value is https://aigrow.gg. With /v1 on the end every request goes to /v1/v1/messages and fails with a 404.
- ANTHROPIC_AUTH_TOKEN or ANTHROPIC_API_KEY?
- Either works with an AIGROW key. ANTHROPIC_AUTH_TOKEN is sent as a Bearer header with no prompt. ANTHROPIC_API_KEY is sent as x-api-key, and in an interactive session Claude Code asks you to approve it once.
- Can I use it for one project only?
- Yes. Put the env block in .claude/settings.local.json at the project root. Claude Code reads it only in that project, and the file is not meant to be committed.
- Does the Claude Agent SDK work the same way?
- Yes, with the same variables passed in its env option. In TypeScript that option replaces the environment, so spread process.env into it; in Python, ClaudeAgentOptions(env=...) adds to it.
- How do I go back to my Claude subscription?
- Remove the variables from your shell and from the env block of settings.json, then start claude again. With no base URL set it uses your Claude login.
Sources: Claude Code LLM gateway · Claude Code Connect a gateway · Claude Code Settings. Read 21 October 2026.
Set up another tool
- ClineOpenAI protocol
The OpenAI Compatible provider, four fields in the settings screen.
- Roo CodeOpenAI protocol
The OpenAI Compatible provider, the same fields as Cline.
- Kilo CodeOpenAI protocol
A custom provider in the Providers tab; the model list fills itself.
- ContinueOpenAI protocol
A models entry in config.yaml, with provider openai and an apiBase.
- AiderOpenAI protocol
OPENAI_API_BASE and OPENAI_API_KEY, then openai/ before the model id.
- OpenCodeOpenAI protocol
A provider block in opencode.json and the key through /connect.
- ZedAnthropic and OpenAI protocols
An Anthropic compatible provider for Claude, an OpenAI compatible one for GPT and Grok.
- GooseOpenAI protocol
The OpenAI provider with OPENAI_HOST, or a custom provider file.
- Vercel AI SDKAnthropic and OpenAI protocols
The OpenAI Compatible provider for every model, or the Anthropic provider for Claude.
- OpenAI Agents SDKOpenAI protocol
Your own AsyncOpenAI client, switched to chat completions, with tracing off.
- LangChainAnthropic and OpenAI protocols
ChatOpenAI with base_url for every model, or ChatAnthropic for Claude.
The API guide has the SDKs, curl, the endpoints and the rate limits.
Paste the block and Claude Code runs on your credit.
Buy a credit pack, redeem the code from your email on API access, create a key and put it in place of ag_your_key_here.