Use Claude Code with Steerwise
Claude Code speaks Anthropic’s Messages API, which Steerwise serves at /v1/messages. Point Claude Code at Steerwise and give it a Steerwise key. /v1/messages serves Claude models only.
- Needs: a Steerwise key
- Endpoint: POST /v1/messages
Set it up
Replace <model id> with auto or any id from GET /v1/models, and YOUR_API_KEY with your key. The Console’s Connect your tool page fills these in for your key and plan.
Add these to your shell profile, or to the shell where you start Claude Code, then run claude.
export ANTHROPIC_BASE_URL="https://api.steerwise.s3techpulse.com"
export ANTHROPIC_AUTH_TOKEN="YOUR_API_KEY"
export ANTHROPIC_MODEL="<model id>"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="<small model id>"
export CLAUDE_CODE_GATEWAY_HINT_HEADERS=1
export CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY=1| Variable | Value | What it does |
|---|---|---|
| ANTHROPIC_BASE_URL | https://api.steerwise.s3techpulse.com | Sends Claude Code to Steerwise. No /v1: Claude Code adds /v1/messages itself. |
| ANTHROPIC_AUTH_TOKEN | YOUR_API_KEY | Your Steerwise key, sent as a Bearer token. |
| ANTHROPIC_MODEL | <model id> | auto, or a Claude model id from GET /v1/models. |
| ANTHROPIC_DEFAULT_HAIKU_MODEL | <small model id> | Keeps Claude Code’s background tasks on a small model; without it they run on the main model and cost more. Set it when your plan has a small Claude model. |
| CLAUDE_CODE_GATEWAY_HINT_HEADERS | 1 | Claude Code sends its request hint headers to a custom base URL only with this set. |
| CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY | 1 | Model discovery lets /model list the models your plan can call. |
Or use settings.json
To keep the setup out of your shell, put the same values in the env block of ~/.claude/settings.json.
{
"env": {
"ANTHROPIC_BASE_URL": "https://api.steerwise.s3techpulse.com",
"ANTHROPIC_AUTH_TOKEN": "YOUR_API_KEY",
"ANTHROPIC_MODEL": "<model id>",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "<small model id>",
"CLAUDE_CODE_GATEWAY_HINT_HEADERS": "1",
"CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY": "1"
}
}Check that it works
Send one short request with the same key. It costs a few tokens and shows up in the Console under Usage, with the model that answered and its cost.
curl https://api.steerwise.s3techpulse.com/v1/messages \
-H "x-api-key: YOUR_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d '{"model": "auto", "max_tokens": 16, "messages": [{"role": "user", "content": "Say hi"}]}' Notes
ANTHROPIC_DEFAULT_HAIKU_MODELkeeps Claude Code’s background tasks on a small model; without it they run on the main model and cost more.- Model discovery lets
/modellist the models your plan can call. - Web search, code execution and fast mode are not available through Steerwise yet; Claude Code carries on without them.
- With
ANTHROPIC_MODEL=auto, each call is routed among Claude models and stays on its pick:/v1/messagesdoes not move a call up a tier. See auto model.
If a request fails
The codes you are most likely to see while setting up:
| Status | Code | When |
|---|---|---|
| 401 | invalid_api_key | The key is malformed, unknown, revoked or expired. |
| 402 | insufficient_balance | The wallet balance is too low for this request. |
| 402 | spend_cap_reached | Spend has reached a daily or monthly cap of the key or the organisation, or the agent run’s cap. |
| 404 | model_not_found | No active model has that id. |
| 429 | rate_limit_exceeded | A per-minute request or token limit, or the limit on calls at once, of the organisation, user, key or model. |
Every code is on Errors and limits.