# Use the API in Claude Code

Source: https://mr-note.com/en/developers/ai-api/claude-code

Point Claude Code at this site's gateway with your key, choose a model and check that it answers.

## Set it up

1. **Make a key** Developer platform → AI API → Create key, and copy it.
2. **Set two variables** ANTHROPIC_BASE_URL is the Anthropic-compatible base URL; ANTHROPIC_AUTH_TOKEN is your key.
3. **Start Claude Code** Run claude in the same shell. Put the variables in your shell profile to keep them.

Claude Code:

```bash
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"
claude
```

## Choose 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

```bash
claude -p "Reply with exactly: ok" --model claude-haiku-5-5
```

It 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.
