Docs pages

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.

bash
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
Claude Code variables
VariableValueWhat it does
ANTHROPIC_BASE_URLhttps://api.steerwise.s3techpulse.comSends Claude Code to Steerwise. No /v1: Claude Code adds /v1/messages itself.
ANTHROPIC_AUTH_TOKENYOUR_API_KEYYour 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_HEADERS1Claude Code sends its request hint headers to a custom base URL only with this set.
CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY1Model 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.

json, ~/.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"
  }
}
Keep the key out of gitDo not put a key in a settings file you commit. Give each developer their own key, with its own caps.

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.

bash
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_MODEL keeps Claude Code’s background tasks on a small model; without it they run on the main model and cost more.
  • Model discovery lets /model list 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/messages does 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:

Common errors
StatusCodeWhen
401invalid_api_keyThe key is malformed, unknown, revoked or expired.
402insufficient_balanceThe wallet balance is too low for this request.
402spend_cap_reachedSpend has reached a daily or monthly cap of the key or the organisation, or the agent run’s cap.
404model_not_foundNo active model has that id.
429rate_limit_exceededA 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.