Claude Code setup: run it on a custom API key
Claude Code speaks the Anthropic Messages API, and MiniStaff serves it at /v1/messages. Three settings and Claude Code runs on a prepaid key — Claude Sonnet 5.5 at $1.00 / $5.00 per 1M tokens, exactly half the official price, with no subscription and no weekly meter.
Before you start
- A MiniStaff account with a topped-up wallet — sign up at app.ministaff.pro ($10 minimum; in India, top up by UPI from ₹950).
- An API key from the dashboard — it starts with
msst_. - Claude Code installed (
claude --versionshould answer).
The settings
The reliable way is the env block in your Claude Code settings file, ~/.claude/settings.json — it is picked up on every launch, from any folder. Add:
{
"env": {
"ANTHROPIC_BASE_URL": "https://api.ministaff.pro",
"ANTHROPIC_AUTH_TOKEN": "msst_your_key_here",
"ANTHROPIC_MODEL": "claude-sonnet-5-5",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "claude-sonnet-5-5",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "claude-haiku-5-5"
}
}
- Base URL is the origin only — no
/v1. Claude Code appends/v1/messagesitself. Adding/v1makes it call/v1/v1/messages, which does not exist. - The model settings are not optional. Claude Code’s built-in default model names are not on the MiniStaff list, so it must be told which models to use — the main model plus the Sonnet/Haiku slots it uses for background work.
- Prefer a one-off session instead? Exporting the same five variables in your shell before running
claudedoes the same thing for that terminal.
Check it works
- From any project folder, run:
claude --print "Reply with exactly: OK"— you should get a short reply, not an API error. - Open your MiniStaff dashboard — the call appears there with its model, token counts and cost, so you can watch the meter yourself.
Prefer to test the endpoint directly first? The same route Claude Code calls, from a terminal:
curl https://api.ministaff.pro/v1/messages \
-H "Content-Type: application/json" \
-H "x-api-key: msst_your_key_here" \
-H "anthropic-version: 2023-06-01" \
-d '{
"model": "claude-sonnet-5-5",
"max_tokens": 16,
"messages": [{"role": "user", "content": "Reply with exactly: OK"}]
}'
Use any of the 19 models
Set ANTHROPIC_MODEL (and the matching default slot) to any ID from the model list:
| Model ID | Input / 1M | Output / 1M | Good for |
|---|---|---|---|
claude-haiku-5-5 | $0.05 | $0.25 | Fast, cheap background work |
claude-sonnet-5-5 | $1.00 | $5.00 | Everyday serious coding |
claude-opus-5-5 | $2.00 | $10.00 | The hardest problems |
deepseek-v4.1-flash | $0.075 | $0.30 | Cheap bulk edits |
The full list is in the docs and at GET /v1/models. Two billing details that matter in long Claude Code sessions: Claude Code reuses a large cached prompt prefix turn after turn, and cached input is billed at 1/10 of the normal input rate here — repeat turns cost far less than the first. MiniStaff stores billing metadata, not prompt or response content.
Troubleshooting
| Error | What it means | Fix |
|---|---|---|
| 401 “Invalid or revoked credential” | Key missing, mistyped or revoked | Re-paste the key from the dashboard, or create a new one |
402 insufficient_quota | Wallet balance is $0 | Top up — the same key resumes working |
| 404 / “model may not exist” | Base URL has /v1 in it, so Claude Code called /v1/v1/messages | Set ANTHROPIC_BASE_URL to https://api.ministaff.pro exactly |
| 400 “Model not available” | A model name Claude Code sent is not on the MiniStaff list | Set ANTHROPIC_MODEL and both default-model variables as above |
429 rate_limit_error | 60 requests/minute per account, or a daily cap on a workhorse model | Wait a few seconds and retry |
Still stuck? Write to [email protected].