- Developer home
- AI API
- Use the API in Claude Code
Use the API in Claude Code
Point Claude Code at this site's gateway with your key, choose a model and check that it answers.
Set it up
- Make a keyDeveloper platform → AI API → Create key, and copy it.
- Set two variablesANTHROPIC_BASE_URL is the Anthropic-compatible base URL; ANTHROPIC_AUTH_TOKEN is your key.
- Start Claude CodeRun claude in the same shell. Put the variables in your shell profile to keep them.
export ANTHROPIC_BASE_URL="https://mroffice.ai/api/ai"
export ANTHROPIC_AUTH_TOKEN="mr-YOUR_KEY"
# optional: the model Claude Code starts with, and its small fast model
export ANTHROPIC_MODEL="claude-sonnet-5-5"
export ANTHROPIC_SMALL_FAST_MODEL="claude-haiku-5-5"
claudeChoose a model
Inside Claude Code, /model switches the model; ANTHROPIC_MODEL sets the one it starts with. The ids are claude-opus-5-5, claude-sonnet-5-5 and claude-haiku-5-5.
Check that it works
claude -p "Reply with exactly: ok" --model claude-haiku-5-5It prints ok, and the request shows under Usage & billing. Claude Code may print an "unrecognized model" notice for these ids: it comes from Claude Code's own list of models and does not affect the answer.