NewHow we catch a seller listing the wrong model, and refund you if one does.

Claude Code

Claude Code talks to MartLLM through its Anthropic-compatible address, https://api.martllm.com. With the address and your key set, Claude Code's commands and tools work as before, and requests are billed to your MartLLM balance.

Set it up by hand

Nothing to run but Claude Code itself. Make a key on your keys page, then:

export ANTHROPIC_BASE_URL=https://api.martllm.com
export ANTHROPIC_AUTH_TOKEN=ull_your_key
claude

Windows PowerShell:

$env:ANTHROPIC_BASE_URL = "https://api.martllm.com"
$env:ANTHROPIC_AUTH_TOKEN = "ull_your_key"
claude

That lasts for the current terminal. To keep it without a key in your shell profile, save the key to a file only you can read:

mkdir -p ~/.uberllm && chmod 700 ~/.uberllm
printf '%s\n' 'ull_your_key' > ~/.uberllm/key && chmod 600 ~/.uberllm/key

and put this in ~/.claude/settings.json (every project) or in <project>/.claude/settings.local.json (one project):

{
  "apiKeyHelper": "cat ~/.uberllm/key",
  "env": {
    "ANTHROPIC_BASE_URL": "https://api.martllm.com"
  }
}

Or use the installer

If you have Node.js, one command sets up Claude Code and the other coding tools on your machine (Codex CLI, OpenCode and more) with the same settings as the installer below:

npx uberllm init

See uberllm init for what it changes and how to undo it.

The installer does the same thing for you and gets the key through your browser. Read it first if you like: it is plain text at martllm.com/install/claude-code.sh.

  • SHA-256 of claude-code.sh: 34646d5a83e25a1c19057a6bca6aeaaf0118e0e43704d5dbb01e49ab15eb625f
  • SHA-256 of claude-code.ps1: 5caaa5f15f3e846c535e6668687fe9e0bdcf1e4f9a8a370af09a5137005f44b4

To check it before running it:

curl -fsSL https://martllm.com/install/claude-code.sh -o claude-code.sh
shasum -a 256 claude-code.sh   # compare with the hash above
sh claude-code.sh

Every project on this computer:

curl -fsSL https://martllm.com/install/claude-code.sh | sh

One project only (run it inside the project; other projects stay on your Anthropic plan):

curl -fsSL https://martllm.com/install/claude-code.sh | sh -s -- --project

Add a folder after --project to set up a project other than the current one.

Windows PowerShell (every project):

irm https://martllm.com/install/claude-code.ps1 | iex

You do not need an API key first, and you do not need to be signed in when you paste the command. The installer opens a link in your browser (https://martllm.com/cli/link?code=XXXX-XXXX) and prints the same confirmation code in the terminal. Sign in, check the code matches, and press Approve.

Approving creates an API key on your account and hands it to the waiting installer. The code in your terminal is not the secret: only the installer that started the request can collect the key, the key is handed out exactly once, and the request expires after 15 minutes.

If Claude Code has never been set up on this computer, use the every-project install first. Claude Code reads a project's own settings only after you trust that folder, so a brand-new install could still ask you to log in.

To print the settings block for your computer without writing anything:

curl -fsSL https://martllm.com/install/claude-code.sh | sh -s -- --print

What the installer writes

The key goes into a file only you can read (folder mode 700, file mode 600):

Install Key file Settings file
Every project ~/.uberllm/key ~/.claude/settings.json (or $CLAUDE_CONFIG_DIR/settings.json)
One project ~/.uberllm/key-<folder>-<number> <project>/.claude/settings.local.json

The settings file gets the address and an apiKeyHelper that reads the key file. The key itself is never written into a settings file, so it does not end up in a backup, a dotfiles repository or a screen share.

{
  "apiKeyHelper": "cat \"/Users/you/.uberllm/key\"",
  "env": {
    "ANTHROPIC_BASE_URL": "https://api.martllm.com",
    "CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY": "1"
  }
}

Claude Code runs apiKeyHelper to get the key and sends it as both Authorization: Bearer and x-api-key, so it works with a gateway such as MartLLM. It keeps the answer for five minutes (CLAUDE_CODE_API_KEY_HELPER_TTL_MS changes that).

The installer merges into your existing file rather than replacing it, so hooks, permissions and MCP servers are kept, and it copies the old file to <file>.bak-<timestamp> first. It removes a plain-text ANTHROPIC_AUTH_TOKEN left by an older install. It then makes one real request through the gateway, so a success message means a request went through.

The Windows installer still writes the key into settings.json as ANTHROPIC_AUTH_TOKEN.

Which setting wins

Claude Code reads settings in this order, first one wins:

  1. Managed settings (set by your company, if any)
  2. claude --settings <file>
  3. <project>/.claude/settings.local.json
  4. <project>/.claude/settings.json
  5. ~/.claude/settings.json

A variable in a settings file's env block wins over the same variable in your shell in most sessions. Two exceptions matter here:

  • The key. Claude Code uses ANTHROPIC_AUTH_TOKEN first, then ANTHROPIC_API_KEY, then apiKeyHelper. A token exported in your shell replaces the saved key.
  • The model. /model in the session wins, then claude --model, then ANTHROPIC_MODEL, then the model setting. A shell ANTHROPIC_MODEL beats the model setting.

So remove every ANTHROPIC_* variable from your shell and your shell profile (~/.zshrc, ~/.bashrc) and keep them in the settings file. The installer warns you when it finds one.

Use other models

By default nothing is pinned: Claude Code asks for its own model names (opus, sonnet, haiku, claude-opus-5-5…) and MartLLM serves the same Claude models. To drive Claude Code with DeepSeek, GLM, Qwen, GPT or any other model, map each of Claude Code's model slots to a MartLLM model id in the env block:

Variable What it sets
ANTHROPIC_MODEL The model the session starts on.
ANTHROPIC_DEFAULT_OPUS_MODEL What opus means.
ANTHROPIC_DEFAULT_SONNET_MODEL What sonnet means.
ANTHROPIC_DEFAULT_HAIKU_MODEL What haiku means. Claude Code also uses it for background work such as titles and summaries.
CLAUDE_CODE_SUBAGENT_MODEL The model subagents run on.
{
  "apiKeyHelper": "cat \"/Users/you/.uberllm/key\"",
  "env": {
    "ANTHROPIC_BASE_URL": "https://api.martllm.com",
    "ANTHROPIC_MODEL": "deepseek/deepseek-v4-pro",
    "ANTHROPIC_DEFAULT_OPUS_MODEL": "deepseek/deepseek-v4-pro",
    "ANTHROPIC_DEFAULT_SONNET_MODEL": "deepseek/deepseek-v4-pro",
    "ANTHROPIC_DEFAULT_HAIKU_MODEL": "deepseek/deepseek-v4-flash",
    "CLAUDE_CODE_SUBAGENT_MODEL": "deepseek/deepseek-v4-pro"
  }
}

Map every slot. A slot left unset keeps asking for a Claude model, and you pay Claude prices for it.

The installer does this for you with a profile:

curl -fsSL 'https://martllm.com/install/claude-code.sh?profile=glm' | sh

Profiles are claude-native (the default, pins nothing), glm, deepseek and gpt. Any model id from the models table works if you set the variables by hand; GET https://api.martllm.com/v1/models lists them.

Context and compaction

Claude Code knows the context size of Claude models only. For any other model it assumes 200,000 tokens and compacts the conversation before that.

  • If the model has a 1-million-token context (its page on martllm.com shows the context), add [1m] to the end of its id, for example "ANTHROPIC_MODEL": "deepseek/deepseek-v4-pro[1m]" or claude --model 'deepseek/deepseek-v4-pro[1m]'. Claude Code then plans for 1M.
  • For any other size, set CLAUDE_CODE_MAX_CONTEXT_TOKENS to the model's context, for example "CLAUDE_CODE_MAX_CONTEXT_TOKENS": "400000".
  • To choose when it compacts: the autoCompactWindow setting (or the CLAUDE_CODE_AUTO_COMPACT_WINDOW variable) takes a number of tokens from 100,000 to 1,000,000. CLAUDE_AUTOCOMPACT_PCT_OVERRIDE (1–100) compacts earlier, at that share of the window. autoCompactEnabled: false turns it off.

Setting a context larger than the model has makes requests fail once the conversation outgrows the model.

What changes

  • Your claude.ai login is not used. Features that need it, such as claude.ai connectors, /schedule and Remote Control, are not available in a session that runs on MartLLM.
  • The cost Claude Code shows is not your bill. Claude Code works it out on your computer from Anthropic's list prices, and shows nothing useful for other models. What you pay is in Dashboard → API Keys → API Usage. Add your balance to the status line (below) to see it while you work.
  • Your code goes to third-party model providers. Everything the session reads 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.

Balance in the status line

curl -fsSL https://martllm.com/install/statusline.sh | sh -s -- --install

This saves a small script to ~/.uberllm/statusline.sh and adds it as Claude Code's statusLine in ~/.claude/settings.json (add --project after --install to put it in this project's .claude/settings.local.json instead). Under the prompt you then see:

MartLLM $12.40 · $0.35 held · Opus

That is your available balance, the amount held for requests still running, and the model. It reads GET /v1/balance with the same key Claude Code uses, at most once a minute. It needs only sh, curl and sed. Read it first at martllm.com/install/statusline.sh.

Verify

Start Claude Code and run /status: the API address is https://api.martllm.com. Then ask it anything; the request shows in Dashboard → API Keys → API Usage within a minute.

The same key answers over the Messages API:

curl https://api.martllm.com/v1/messages \
  -H "Authorization: Bearer $(cat ~/.uberllm/key)" \
  -H "anthropic-version: 2023-06-01" \
  -H "content-type: application/json" \
  -d '{"model":"claude-haiku-4-5","max_tokens":16,"messages":[{"role":"user","content":"ping"}]}'

If a request fails with Your apiKeyHelper script is failing, the key file is missing or unreadable: run the installer again.

Uninstall and revoke

curl -fsSL https://martllm.com/install/claude-code.sh | sh -s -- --uninstall

For a one-project install, run it inside the project with sh -s -- --project --uninstall. It backs up the settings file first, removes only what it added, and deletes the saved key file. Claude Code goes back to your Anthropic login on the next start.

Uninstalling does not revoke the key; it only stops using it. Delete the key on your keys page to make sure it can never spend again. Do that for any computer you no longer trust, or if you approved a request you did not start.