Claude Code
Run Claude Code against open models on sference: one-command launch, manual ANTHROPIC_BASE_URL config, model recommendations, and known limits.
Claude Code
Claude Code talks to the Anthropic Messages API, and sference serves that API for open models. Point it at sference and your agent loop runs on zai-org/GLM-5.3, moonshotai/Kimi-K3, or your own fine-tune, at open-model token prices, with the same request-level audit trail as the rest of the platform.
Fastest path: sference launch claude
The sference CLI ships a launcher that configures everything and starts Claude Code for you:
curl -fsSL https://raw.githubusercontent.com/s-ference/sference/main/install.sh | sh
sference auth login
sference launch claudeThe launcher points Claude Code at sference directly via ANTHROPIC_BASE_URL (native /v1/messages) and enables gateway model discovery: the live catalog is primed into Claude Code's picker cache before launch, so /model lists every sference model your account can serve. No proxy, no mitmproxy, and nothing left behind when the session ends.
| Command | What it does |
|---|---|
sference launch claude | Launch Claude Code on sference. Catalog models are fetched live from GET /v1/models. |
sference launch claude --model zai-org/GLM-5.3 | Pin a different default model. |
sference launch claude --models a,b | Override the primed picker set. |
sference launch claude --dry-run | Print the env config and command without launching. |
sference launch claude --enable-tool-search | Set ENABLE_TOOL_SEARCH=true. |
sference launch claude -- -p "summarize this repo" | Forward flags after -- to Claude Code itself. |
Every model alias Claude Code resolves internally (opus/sonnet/haiku/fable, subagents, background tasks) is pinned to the same catalog model, so no request goes out with a claude-* id the API cannot serve. --no-anthropic and --proxy-port are accepted as deprecated no-ops for older scripts — the direct env-var mode is the only mode.
The launcher does not route per model family: nothing in the session reaches Anthropic. To keep Claude models and add sference models next to them, or to send only some families (for example sub-agents) to an open model, use Sference Switch.
Default model: moonshotai/Kimi-K3. Override with --model or the SFERENCE_MODEL environment variable.
Manual configuration
If you would rather not install the CLI, configure Claude Code directly. Everything goes through ANTHROPIC_BASE_URL, so all traffic, including claude-* model names, hits sference, and the model is whatever you pin.
Add to ~/.claude/settings.json (or .claude/settings.json in a project):
{
"env": {
"ANTHROPIC_BASE_URL": "https://api.sference.com",
"ANTHROPIC_AUTH_TOKEN": "sk_your_sference_key",
"ANTHROPIC_MODEL": "zai-org/GLM-5.3"
}
}- Prefer
ANTHROPIC_AUTH_TOKEN(sent asAuthorization: Bearer).ANTHROPIC_API_KEYalso works (sference acceptsx-api-key), but set one or the other, not both. ANTHROPIC_MODELmust be a sference catalog id. There are noclaude-*aliases; a Claude model name returns 404not_found_error. See Models.- Restart Claude Code after editing settings.
Verify the endpoint independently of Claude Code:
curl https://api.sference.com/v1/messages \
-H "Authorization: Bearer $SFERENCE_API_KEY" \
-H "content-type: application/json" \
-d '{
"model": "zai-org/GLM-5.3",
"max_tokens": 256,
"messages": [{ "role": "user", "content": "hi" }]
}'Choosing a model
| Model | Why |
|---|---|
moonshotai/Kimi-K3 | The launch claude default. Largest reasoning model in the catalog, image input, and it tolerates Claude Code's default request shape. |
zai-org/GLM-5.3 | Strong general coding model, low latency, cheaper per token; the current generation of the family. |
| Your fine-tune | Custom models work on /v1/messages like any catalog model. |
Live ids and pricing: GET https://api.sference.com/v1/models.
What to expect
Two API calls per prompt is normal. Claude Code fires a separate title-generation request alongside your actual turn: no tools, a <session> user body, asking for a JSON title. sference detects it, caps it at 512 completion tokens, and forces reasoning off so it does not burn tokens on chain-of-thought before emitting a title. Seeing two requests per prompt in the console is expected, not a bug.
Thinking works, signatures do not. Reasoning models stream thinking blocks that Claude Code renders normally, but signature is always empty. Multi-turn thinking continuity is best-effort: sference re-injects the inbound thinking text rather than a verified signed block.
Vision depends on the model. Image blocks and screenshots go through to vision-capable models (the launch claude default moonshotai/Kimi-K3 is one — check capabilities.image_input.supported on GET /v1/models). On a text-only model, image content is replaced with a placeholder and sference injects a system notice telling the agent it has no vision, so it stops retrying image capture and verifies with Read, grep, and build output instead. moonshotai/Kimi-K3, deepseek-ai/DeepSeek-V4.1-Flash-1017 or zai-org/GLM-5.3-Flash are the current vision-capable ids.
Tool search may be off. Claude Code disables tool search on non-Anthropic hosts unless told otherwise. sference launch claude --enable-tool-search sets ENABLE_TOOL_SEARCH=true for you.
Known limits
| Limit | Effect |
|---|---|
Empty thinking signature | Multi-turn thinking history degrades; nothing to verify or decrypt. |
No redacted_thinking | Anthropic's encrypted thinking blocks are never produced. |
budget_tokens, thinking: adaptive, effort, display | Accepted and ignored; bound output with max_tokens. |
| No prompt-caching controls | cache_control blocks are ignored. Prefix caching is automatic; hits show up as cache_read_input_tokens. |
| No server-side tools | MCP connectors, web search, code execution, and computer use are Anthropic-hosted and unavailable. Locally-run MCP servers configured in Claude Code work normally. |
| Realtime only | No service_tier: "flex", no background execution on /v1/messages. |
| Model-dependent tool reliability | Open models call tools less consistently than Opus/Sonnet on long agent loops. |
The full compatibility surface, covering every supported field, block type, and streaming event, is on the Anthropic Messages API page.
Troubleshooting
401 Unauthorized. The key must be a sference sk_... key. If both ANTHROPIC_API_KEY and ANTHROPIC_AUTH_TOKEN are set, unset one. A stale Anthropic key in your shell profile overriding the sference key is the usual cause.
404 not_found_error. ANTHROPIC_MODEL is a Claude name, or not a model in your catalog. Check GET /v1/models. A 403 permission_error instead means an organization or member allowlist blocks that model.
402 billing_error. The team credit balance is exhausted, or a spend limit was reached. Top up or raise the limit in the console.
Raw <tool_call> or </think> text in replies instead of tool calls. The model emitted tool syntax the parser did not extract, usually because max_tokens was too low and the call was truncated mid-JSON. Raise max_tokens (Claude Code tool turns need real headroom) or switch to a model with better tool support.
Slow first token. Long time-to-first-token on a queued request is normal under load; the stream sends ping keepalives while waiting. A request that never completes within the 1200s sync window returns 504 and is cancelled server-side.
504 Gateway Timeout. A single turn exceeded the sync inference window. Shorten the turn, reduce context, or pick a faster model.
Related
Auto model routingComing soon
sference/auto picks a model per session from the first user message — low, medium, or high tier — and keeps it for the session. Beta, org opt-in.
Pi
Route Pi through sference: one command, a sference provider in ~/.pi/agent/models.json, and a model picker scoped to the sference catalog.