Claude Code on MartLLM
Claude Code sends requests to the address in ANTHROPIC_BASE_URL. With that set to MartLLM, Claude Code keeps requesting the same Claude models, and each request is billed at the current market price instead of Anthropic’s list price. Setup is two environment variables, or one command that sets them for you.
Keep the exact models Claude Code ships with. Opus stays Opus, Sonnet stays Sonnet — routed through the market instead of billed at list.
Set it up by hand
# Make a key at https://martllm.com/dashboard/keys, then:
export ANTHROPIC_BASE_URL=https://api.martllm.com
export ANTHROPIC_AUTH_TOKEN=ull_your_key
claudeLasts for this terminal. To keep it, put the same values in the env block of ~/.claude/settings.json. Guide
Or run the installer
curl -fsSL https://martllm.com/install/claude-code.sh | shScript SHA-256: 34646d5a83e25a1c19057a6bca6aeaaf0118e0e43704d5dbb01e49ab15eb625f. Read it at /install/claude-code.sh, or check it first: curl -fsSL https://martllm.com/install/claude-code.sh -o claude-code.sh && shasum -a 256 claude-code.sh A copy with its SHA256SUMS is also on GitHub.
- 1Run the command
It backs up ~/.claude/settings.json, then points Claude Code at MartLLM with your key.
- 2Approve in the browser
The script opens a tab and waits. Approving mints a key for this machine — nothing else.
- 3Run claude
Same CLI, same models, same workflow. /status shows the gateway instead of Anthropic.
The same Claude models, up to 89% less
The best price on the MartLLM market right now for every Claude model we sell, next to Anthropic’s official price for the same model. Biggest saving first.
| Model | MartLLM in / out | Anthropic list in / out | You save |
|---|---|---|---|
Claude Sonnet 4.6 anthropic/claude-sonnet-4.6 | $0.3087 / $1.5434 $3.00 / $15.00 | $3.00 / $15.00 | 89% less |
Claude Opus 4.6 anthropic/claude-opus-4.6 | $0.518 / $2.59 $5.00 / $25.00 | $5.00 / $25.00 | 89% less |
Claude Opus 4.5 anthropic/claude-opus-4.5 | $0.5645 / $2.8223 $5.00 / $25.00 | $5.00 / $25.00 | 88% less |
Claude Opus 4.7 anthropic/claude-opus-4.7 | $0.8056 / $4.0281 $5.00 / $25.00 | $5.00 / $25.00 | 83% less |
Claude Opus 5.5 anthropic/claude-opus-5.5 | $0.678 / $3.39 $4.00 / $20.00 | $4.00 / $20.00 | 83% less |
Claude Sonnet 5 anthropic/claude-sonnet-5 | $0.35 / $1.75 $2.00 / $10.00 | $2.00 / $10.00 | 82% less |
Claude Opus 5 anthropic/claude-opus-5 | $0.8991 / $4.4955 $5.00 / $25.00 | $5.00 / $25.00 | 82% less |
Claude Opus 4.8 anthropic/claude-opus-4.8 | $0.90 / $4.50 $5.00 / $25.00 | $5.00 / $25.00 | 82% less |
Claude Sonnet 5.5 anthropic/claude-sonnet-5.5 | $0.36 / $1.80 $2.00 / $10.00 | $2.00 / $10.00 | 82% less |
Claude Haiku 5.5 anthropic/claude-haiku-5.5 | $0.018 / $0.09 $0.10 / $0.50 | $0.10 / $0.50 | 82% less |
Claude Fable 5 anthropic/claude-fable-5 | $2.2277 / $11.1387 $10.00 / $50.00 | $10.00 / $50.00 | 77% less |
Claude Fable 5.1 anthropic/claude-fable-5.1 | $2.40 / $12.00 $10.00 / $50.00 | $10.00 / $50.00 | 76% less |
Claude Fable 5.2 anthropic/claude-fable-5.2 | $2.8484 / $14.2418 $8.00 / $40.00 | $8.00 / $40.00 | 64% less |
Claude Haiku 4.5 anthropic/claude-haiku-4.5 | $0.3608 / $1.8042 $1.00 / $5.00 | $1.00 / $5.00 | 63% less |
Claude Opus 5 (Fast) anthropic/claude-opus-5-fast | $5.3397 / $26.6985 $10.00 / $50.00 | $10.00 / $50.00 | 46% less |
Claude Sonnet 4.5 anthropic/claude-sonnet-4.5 | $2.10 / $10.50 $3.00 / $15.00 | $3.00 / $15.00 | 30% less |
Prices are $/million tokens. The saving column blends input and output at 1:3 on both sides. Anthropic’s prices are the official list prices in our catalog, which matched Anthropic’s pricing page on October 29, 2026; a model without an official price is left out rather than estimated. Live prices move, so what you pay is what the provider charged at request time.
How it works
The installer saves your key to ~/.uberllm/key, a file only you can read, and writes ANTHROPIC_BASE_URL and an apiKeyHelper that reads that file into ~/.claude/settings.json. The key is never written into a settings file. Your existing settings file is backed up and merged into; hooks, permissions and MCP servers are kept. Claude Code itself is not modified, reinstalled or wrapped.
Start Claude Code and run /status: it will report the gateway as the API endpoint. Projects, sessions, slash commands and subagents work as before.
Only these settings are ever managed by the installer; on the default profile only the base URL and model discovery are set:
- ANTHROPIC_BASE_URL
- ANTHROPIC_MODEL
- ANTHROPIC_DEFAULT_OPUS_MODEL
- ANTHROPIC_DEFAULT_SONNET_MODEL
- ANTHROPIC_DEFAULT_HAIKU_MODEL
- CLAUDE_CODE_SUBAGENT_MODEL
- CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY
{
"apiKeyHelper": "cat ~/.uberllm/key",
"env": {
"ANTHROPIC_BASE_URL": "https://api.martllm.com"
}
}One project only
Run this inside the project instead. It writes .claude/settings.local.json there, so your other projects stay on your Anthropic plan:
curl -fsSL https://martllm.com/install/claude-code.sh | sh -s -- --projectYour balance in the status line
Claude Code’s own cost figure is an estimate, not your bill. This puts your MartLLM balance, and any amount held for running jobs, under the prompt:
curl -fsSL https://martllm.com/install/statusline.sh | sh -s -- --installReversible, and revocable
The uninstaller removes the keys it added and restores the settings it found:
curl -fsSL https://martllm.com/install/claude-code.sh | sh -s -- --uninstallTo cut access without editing anything, revoke the key at /dashboard/keys. Each install gets its own key, so revoking one machine leaves the rest working.
Use an open model
Optional. Each profile pins an open model for every Claude Code model slot. These models cost less per token than Claude, and their results differ from Claude’s. Choose a profile in the installer above.
GLM 5.2
1M context, strong tool use, roughly a fiftieth of Claude pricing.
DeepSeek V4
1M context reasoning model, priced for all-day agentic work.
GPT-5.4
If you would rather drive Claude Code with OpenAI’s latest.
Support and affiliation
Anthropic does not support or endorse routing Claude Code to a third-party gateway, and it does not endorse running it on non-Claude models. The default profile keeps the same Anthropic models Claude Code ships with, so what changes is the billing path, not the model; the cheaper profiles swap the model out, and its behaviour will differ from Claude’s. MartLLM is an independent marketplace and is not affiliated with Anthropic.
FAQ
Does this change how Claude Code behaves?
On the default profile, no. No model is pinned: Claude Code requests its own model ids and MartLLM serves the same Anthropic models. What changes is the price you are billed and the login: features that need the claude.ai login are not available. The optional profiles replace the model, so results differ.
Do I have to pipe a script into my shell?
No. Setting ANTHROPIC_BASE_URL to https://api.martllm.com and ANTHROPIC_AUTH_TOKEN to your key is enough; the installer only does that for you and keeps the key out of your settings file. If you use it, read it first at https://martllm.com/install/claude-code.sh and compare its SHA-256 with the one shown next to the command.
What does the installer actually write?
It saves your key to ~/.uberllm/key, a file only you can read, and writes ANTHROPIC_BASE_URL plus an apiKeyHelper that reads that file into ~/.claude/settings.json, merging into your existing file after taking a backup. The key itself is never written into a settings file (the Windows installer still writes it as ANTHROPIC_AUTH_TOKEN). Your hooks, permissions and MCP servers are left alone. A cheap profile additionally pins the model keys; the default profile pins nothing.
Can I use MartLLM in one project only?
Yes. Run curl -fsSL https://martllm.com/install/claude-code.sh | sh -s -- --project inside that project. It writes .claude/settings.local.json in that folder, so every other project stays on your Anthropic plan. That file wins over your user settings for this project.
How do I undo it?
Run the uninstaller: curl -fsSL https://martllm.com/install/claude-code.sh | sh -s -- --uninstall (add --project for a project setup). It removes the settings it added and the saved key file, and leaves the rest of your settings in place. You can also revoke the key on its own at /dashboard/keys, which cuts access without touching any file.
Do I need an account before I run the command?
No. The one-liner opens your browser and waits for you to approve, minting a key for that machine as part of the install. If you are already signed in, the “Download installer” button hands you a script with a fresh key already baked in and skips the browser step entirely.
Is my Claude subscription used?
No. Requests go to the MartLLM gateway and are billed against your MartLLM balance at the prices on this page. Your Claude.ai or Claude Code subscription is untouched, and unused while the gateway is configured. Features that need the claude.ai login, such as claude.ai connectors, are not available in that session. The cost Claude Code shows is its own estimate, not your bill: see what you really spend in Dashboard → Activity, or add the MartLLM balance to the status line.
Where does my code go?
Everything Claude Code reads in a session is sent to the model, which is run by third-party model providers on the MartLLM market. Do not use it in a repository that holds secrets, credentials or customer data.
Can I use a cheaper model instead?
Yes. Pick a different profile before you install and it pins that model (GLM, DeepSeek or GPT) for the main, small/fast and subagent slots. You can re-run the installer with a different profile at any time to switch.
Set up Claude Code on MartLLM
Credit is prepaid, from $5. Each request is billed what its provider charged. No MartLLM fee on requests. Adding credit by card costs 5.5% + $0.50.