Contents
To run Claude Code on a custom endpoint, set ANTHROPIC_BASE_URL to the endpoint and ANTHROPIC_AUTH_TOKEN to its key. For SolCard Inference that’s one line:
ANTHROPIC_BASE_URL=https://api.solcardinference.ai \
ANTHROPIC_AUTH_TOKEN=sk-si-... \
claude --model solcard-inference-fast
We ran exactly this today: Claude Code read a file with its Read tool and answered, on SolCard Inference.
This replaces Claude for that session. Every model request goes to SolCard Inference, and your Claude models aren’t available until you unset the variables. To keep your Claude models and add ours next to them, use the one-sentence install instead.
The two values
ANTHROPIC_BASE_URL=https://api.solcardinference.ai. No/v1on the end: Claude Code adds/v1/messagesitself. With/v1on the end, requests would go to/v1/v1/messages.ANTHROPIC_AUTH_TOKEN=sk-si-.... Your SolCard Inference key, from the dashboard’s API keys page. It’s shown once, so save it when you create it.
Then pick the model with --model:
| Model | Use it for |
|---|---|
solcard-inference-fast | Everyday turns: reading files, small edits, running tests |
solcard-inference-large | Planning a change, a bug you can’t find. It always reasons |
solcard-inference-base | General purpose, 262k context |
Fast, Large or Base has the details.
Claude Code logs [claude-code:unrecognized_model] for our model names, because they aren’t on its built-in list. It’s harmless; the session works.
ANTHROPIC_AUTH_TOKEN or ANTHROPIC_API_KEY
Both work. Anthropic’s gateway guide explains the difference: ANTHROPIC_AUTH_TOKEN sends the key “in Authorization: Bearer”, and ANTHROPIC_API_KEY sends it “in x-api-key”. Our API accepts either header on every endpoint.
Use ANTHROPIC_AUTH_TOKEN. It’s what we tested, and it’s what Anthropic’s guide recommends: “If you weren’t told which kind, use ANTHROPIC_AUTH_TOKEN.” With ANTHROPIC_API_KEY, the guide says “you are prompted once in interactive mode to approve the key before it takes over.”
Check the key before you start
Send one request with curl, adapted from Anthropic’s guide:
export ANTHROPIC_BASE_URL=https://api.solcardinference.ai
export ANTHROPIC_AUTH_TOKEN=sk-si-...
curl -sS -X POST "$ANTHROPIC_BASE_URL/v1/messages" \
-H "Authorization: Bearer $ANTHROPIC_AUTH_TOKEN" \
-H "content-type: application/json" \
-d '{"model": "solcard-inference-fast", "max_tokens": 16, "messages": [{"role": "user", "content": "Say hi."}]}'
A JSON reply with a content field means the URL and key work. A 401 means the key was rejected: check you copied all of it, and that it isn’t revoked. Our Messages API accepts the anthropic-version header but doesn’t require it.
Then run claude from the same terminal. Anthropic’s guide says /status shows an Anthropic base URL line when a gateway is set.
Make it stick
Shell variables last for one terminal. Anthropic’s guide gives two ways to keep them, which we haven’t tested ourselves:
- Your shell profile: add the two
exportlines to~/.zshrcor~/.bashrc. Every new terminal then starts Claude Code on SolCard Inference. - A settings file: the
envblock in~/.claude/settings.json, which applies everywhere Claude Code runs:
{
"env": {
"ANTHROPIC_BASE_URL": "https://api.solcardinference.ai",
"ANTHROPIC_AUTH_TOKEN": "sk-si-..."
}
}
Either way, that’s every session on our models until you take it out. Don’t put the key in a project’s .claude/settings.json: the guide warns that file “is committed and shared with everyone who clones the repository.”
For our model names in the /model picker, the guide documents CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY=1. We haven’t tested it against our endpoint; --model works.
What you give up
- Your Claude models, for that session. Per Anthropic’s guide, a gateway credential “takes precedence over a saved claude.ai login.” Your login stays saved, unused.
- Claude-only features. The guide says Remote Control “is also disabled while
ANTHROPIC_BASE_URLpoints at a non-Anthropic host,” and voice dictation is unavailable while a gateway credential is set.
If you want both, don’t use this route. The one-sentence install runs a small local proxy: requests for your Claude models go to Anthropic on your own plan, and requests for ours go to SolCard Inference. /model lists both.
What it costs
Claude Code resends the conversation every turn, so most of its input is cached, and cached input costs a tenth of the normal rate: $0.125 per million tokens on Fast, against $1.25 for new input. A typical turn on Fast comes to about two cents; the install guide works through the numbers. Every request bills your prepaid balance, and your usage page lists each one. See how billing works.
Switching back
Unset the variables, or close the terminal if you only set them there:
unset ANTHROPIC_BASE_URL ANTHROPIC_AUTH_TOKEN
If you added them to your shell profile or settings.json, delete those lines. Per Anthropic’s guide, “unset the variable and Claude Code goes back to” your saved claude.ai login.
FAQ
Does the base URL need /v1?
No. Use https://api.solcardinference.ai. Claude Code adds /v1/messages.
Can I keep my Claude models and use SolCard Inference too?
Not with these variables; they send every request to us. Use the one-sentence install, which lists both in /model.
Do Claude Code’s tools work? Yes. In our test, Claude Code read a file with its Read tool and answered from it. Our models take text only, so image input won’t work.
What happens when my balance runs out?
On pay as you go, requests stop with 402 insufficient_balance until you top up. With a plan, API keys use your credits first, then your plan.