Claude Code
Claude Code speaks the
Anthropic Messages API. Hyphen serves that API at /v1/messages, so Claude
Code can talk to the gateway — once you map its model tiers to Hyphen
models. That mapping is required; skip it and every request fails. The
copy-paste block below does the whole thing.
The /v1/messages surface is verified live, including tool calling and streaming. This settings.json block comes from Claude Code's official documentation and has not been run end to end. Corrections to support@hyphen-solution.com.
1. Get a key
app.hyphen-solution.com → sign in → pick a
plan or credit pack → Dashboard → API Keys. Copy the sk-... key.
2. Configure — one copy-paste block
Create or edit ~/.claude/settings.json and paste this. Replace the token
with your key; leave the model mappings as-is.
Code
That's the entire setup. Restart Claude Code so it re-reads the file, then jump to Verify.
Prefer shell exports?
The same config as environment variables — add to ~/.zshrc or ~/.bashrc:
Code
Then source ~/.zshrc (or open a new terminal) and run claude.
Why the model mappings are required
This is the detail that breaks setups, so it's worth 30 seconds.
Claude Code doesn't send a model name like minimax-m3. It sends its own
default model names (claude-sonnet-4-..., claude-opus-4-...,
claude-haiku-...) — the names of the models it was built to talk to. The
Hyphen gateway only accepts the real model IDs in its catalog; sending anything
else returns:
Code
So pointing only ANTHROPIC_BASE_URL at Hyphen is not enough — every
request 400s on the model name. The ANTHROPIC_DEFAULT_*_MODEL variables fix
this: they tell Claude Code to substitute a real catalog model wherever it
would otherwise send one of its default names.
Code
We map both the Sonnet and Opus tiers to minimax-m3 (the flagship — the
newest M-series generation) so heavy agent work always lands on it, and the
Haiku tier — Claude Code's lightweight background tier — to minimax-m2.5
(the fast tier) to keep those calls cheap.
Want a lighter, cheaper default?
Map the Sonnet tier to minimax-m2.7 (balanced) instead — day-to-day work gets
cheaper, and you can still call the flagship on demand:
Code
3. Verify
Code
If it prints connected, Claude Code is wired to the gateway and the model
mapping is working. (A 400 Invalid model name here means the
ANTHROPIC_DEFAULT_*_MODEL variables aren't being read — see below.)
Troubleshooting
400 Invalid model name— the model mappings aren't taking effect. Confirm~/.claude/settings.jsonis valid JSON (no trailing commas) and that you restarted Claude Code. If you used shell exports, make sure the current terminal actually has them (echo $ANTHROPIC_DEFAULT_SONNET_MODEL).401 Invalid API key— thesk-...token is wrong or unset. Re-copy it from the console and checkANTHROPIC_AUTH_TOKEN.429— your monthly budget is spent. Claude Code surfaces the reset date; see Rate limits & caps.- Env var names changed? Flag and env names can shift between Claude Code
releases. If a variable seems ignored, check
claude --helpfor the current names in your installed version. - Settings not applied at all — Claude Code reads
~/.claude/settings.jsonon startup. Fully quit and relaunch; delete and recreate the file if a stale copy is being picked up.