Claude Code Different Model: Gateway Base URL Setup
Claude Code different model setups work by pointing ANTHROPIC_BASE_URL at a gateway that serves more than one model, then choosing a name from the docs list. Write the URL without /v1, because Claude Code appends /v1/messages itself. The same API key then works across the text and code models listed in the catalog.
To run Claude Code on a different model, set ANTHROPIC_BASE_URL to a gateway without /v1, add the auth token, and use a model name that exists in the docs catalog.
Why Claude Code can run a different model
Claude Code doesn't call a model directly. It sends requests to an Anthropic-compatible endpoint, and an endpoint that answers the /v1/messages format is handled the same way whichever model sits behind it. Two variables decide where those requests go: ANTHROPIC_BASE_URL for the destination and ANTHROPIC_AUTH_TOKEN for credentials.
So switching models in Claude Code is a configuration change, not a source code change. You point the base URL at a gateway with a wider catalog. The TokenomixAI gateway serves text and code models through one API key in the sk-tkx-... format, and its endpoint follows the format Claude Code expects.
How to point Claude Code at another model
There are two routes: a one-command installer, or editing the env block in Claude Code's settings file yourself. The installer saves typing, which lowers the risk of a typo in the URL or the token.
Option 1: the one-command installer
Run the command for your platform, then paste the API key when the script asks for it. The key is never put in a URL.
bash <(curl -fsSL https://tokenomixai.com/install/claude.sh)irm https://tokenomixai.com/install/claude.ps1 | iexThe installer writes ANTHROPIC_BASE_URL=https://api.tokenomixai.com and ANTHROPIC_AUTH_TOKEN into the env block of ~/.claude/settings.json. On Windows the same file lives at %USERPROFILE%\.claude\settings.json. Other settings stay in place, and a backup is made first.
Option 2: set it by hand
If you prefer to edit the file yourself, the env block looks roughly like this:
{
"env": {
"ANTHROPIC_BASE_URL": "https://api.tokenomixai.com",
"ANTHROPIC_AUTH_TOKEN": "sk-tkx-..."
}
}Save the file and start a new Claude Code session so the variables load. More detail on the settings file is in the docs, and the overall flow is on the Claude Code page.
Claude Code base URL: why it must have no /v1
Check this first when a session fails. For Claude Code, set ANTHROPIC_BASE_URL to https://api.tokenomixai.com alone, without /v1. Claude Code appends /v1/messages itself, so adding /v1 doubles the path and the request is rejected.
Other tools do use /v1 in the base URL because they send their own relative paths. The table below sums up the difference.
| Tool | Base URL |
|---|---|
| Claude Code | https://api.tokenomixai.com |
| OpenCode, Cursor, Cline, n8n, OpenAI-compatible SDKs | https://api.tokenomixai.com/v1 |
If you already installed OpenCode, don't copy its base URL into Claude Code. The API key can be the same, but each tool keeps its own setting. The OpenCode steps are in Install OpenCode in VS Code.
Picking a model from the docs catalog
Once the base URL is right, choose a model. The model list, context sizes and multipliers live in the docs, not in this article, because the catalog changes.
Copy the model name exactly as it appears in the list. An invented ID or an extra suffix won't match anything in the catalog, and the request is rejected even when the API key itself is valid.
How you switch models inside Claude Code follows Claude Code's own documentation at claude.ai. On the gateway side, the model you pick has to be listed in /docs. TokenomixAI sells tokens for text and code models only; some models accept images as input, but there is no image, video or audio generation.
Check token quota and rate limit before long sessions
Quota is counted in tokens, not in time windows, so there is no 5-hour limit. The key stays valid while tokens remain and before it expires. Check the balance with one request:
curl https://api.tokenomixai.com/v1/quota -H "Authorization: Bearer sk-tkx-..."The response includes status (active or exhausted), remainingTokens, maxTokens, usagePercent, expiresAt, and low, which is true when 10% or less remains.
There is also a rate limit of 600 requests per minute per account, shared by all its keys. Above that the API returns 429 with a Retry-After header. Wait for the stated time instead of resending the requests all at once.
Restoring your previous settings
If you want Claude Code back on its old configuration, the installer can reverse its changes.
bash <(curl -fsSL https://tokenomixai.com/install/claude.sh) --restore$env:RESTORE="1"; irm https://tokenomixai.com/install/claude.ps1 | iexOn Windows, set RESTORE as an environment variable before running the command. Restore works the same way as it does for the OpenCode installer.
When Claude Code can't connect
Start with the base URL and the token, then look at the model. A practical order to check:
- Request rejected and the path looks wrong:
ANTHROPIC_BASE_URLstill has/v1. Remove it so onlyhttps://api.tokenomixai.comremains. - Token rejected:
ANTHROPIC_AUTH_TOKENis wrong, empty, or expired. Compare it with theexpiresAtvalue from the quota endpoint. - 429 response: the 600 requests per minute rate limit was exceeded. Wait for
Retry-Afterbefore sending again. statusisexhausted: tokens ran out, so top up. The key stays the same, remaining tokens are added together, and validity follows the latest top-up.- Model rejected: the name isn't in the /docs catalog. Copy it again exactly from the list.
Frequently asked questions
Does the gateway store my prompts and code?
No. The TokenomixAI gateway logs request metadata only: the model used, token count, time and status. Prompts and completions are not stored. That applies to the gateway, not to other tools running on your machine.
Does Claude Code with another model work on Windows?
Yes. There is a PowerShell installer for Windows, and it writes the settings to %USERPROFILE%\.claude\settings.json. If you edit the file by hand, fill in the same env block there.
Do I need an account or a credit card to try it?
No account and no credit card. Buy a package on the website and the key is sent after payment. Payment is by QRIS (Indonesia) or USDT.
Does the API key change after a top-up?
No, the key stays the same and there is no need to replace it. Remaining tokens from earlier top-ups are added to the new ones, and validity follows the latest top-up.
Can I use it to generate images?
No. TokenomixAI sells tokens for text and code models only. Some models accept images as input, but there is no image, video or audio generation.