Skip to content
DOCS / Claude Code

Claude Code

Route Claude Code through Fast Inference's native Anthropic Messages endpoint with reversible model configuration.

The fast claude adapter routes Claude Code through Fast Inference's native Anthropic-compatible /v1/messages surface. It maps Claude Code's model slots to one callable catalog model and keeps a snapshot of your original settings.

Connect Claude Code

  1. Install and sign in

    bash
    npm install -g @inference/fast
    fast login
  2. Enable the adapter

    bash
    fast claude on

    The command creates or reuses this machine's project API key, writes the gateway and model map to ~/.claude/settings.json, and saves the original file under ~/.inference-fast/backups. Restart Claude Code after it completes.

  3. Verify the route

    bash
    fast claude status

    Start a new Claude Code session and send a short prompt. The request should appear under Usage with the selected Fast Inference model.

Model slots

Claude Code uses six named model slots. The adapter points all six at the model you select, which defaults to glm-5.2.

SlotClaude Code settingDefault
MainANTHROPIC_MODELglm-5.2
OpusANTHROPIC_DEFAULT_OPUS_MODELglm-5.2
SonnetANTHROPIC_DEFAULT_SONNET_MODELglm-5.2
HaikuANTHROPIC_DEFAULT_HAIKU_MODELglm-5.2
FableANTHROPIC_DEFAULT_FABLE_MODELglm-5.2
SubagentsCLAUDE_CODE_SUBAGENT_MODELglm-5.2

Choose another callable model from the model catalog:

bash
fast claude on --model <catalog-id>

Running on again updates the managed settings while retaining the original restoration snapshot.

Key handling

Your first agent connection creates one machine-scoped API key for the first project in your personal workspace. The CLI stores that key in its owner-private state and reuses it across supported adapters. Raw key values are not printed.

Restore your settings

bash
fast claude off

off restores the original settings.json snapshot and removes the backup. Restart Claude Code after restoring it.

Troubleshooting

  • If status says off, rerun fast claude on and restart Claude Code.
  • If requests return 401, run fast status and reconnect the agent.
  • If a model is rejected, choose a currently callable ID from the model catalog.
  • If the config cannot be parsed, repair settings.json before reconnecting.