ANTHROPIC_BASE_URL points at. Sail serves that API for
GLM-5.2 — system prompts, tool calling, and streaming included — so pointing
Claude Code at Sail is just environment configuration. The launcher below does
it in one command.
Quickstart (terminal)
Install Claude Code if you haven’t, then launch it routed to Sail:SAIL_API_KEY set or a sail auth login credential — the launcher opens your browser to create a Sail API key
and saves it to ~/.sail (the same file sail auth login uses), then starts
claude on GLM-5.2. Your Claude Code setup is left untouched and your
Anthropic credentials are never involved. To avoid writing a key to disk, set
SAIL_API_KEY in your environment instead — the launcher uses it directly and
persists nothing.
Trusted workspaces (no permission prompts)
For trusted repos, containers, or VMs where you want long-running agent tasks without clicking through Claude Code permission prompts, use:--trusted launches Claude Code in bypass-permissions mode. This avoids Claude
Code’s auto-mode safety classifier path, so it also avoids failures like
safety classifier temporarily unavailable when Sail model requests are
otherwise healthy. Use it only where you are comfortable letting Claude Code run
tools without prompting.
Pass flags through to claude after --:
VS Code extension
The VS Code extension isn’t launched from your shell, so per-invocation environment can’t reach it. Persist the routing instead:Preferences: Open User Settings (JSON)) and reload the window — the setup command prints this snippet:
setup --project to scope the
routing to one repository — it writes your API key into
.claude/settings.local.json (Claude Code’s personal, not-shared project
file) and adds that file to .claude/.gitignore so it stays out of commits.
Claude Code applies project settings only after you trust the folder in its
first-run prompt.
Choosing models
GLM-5.2 is the default. The/model picker also exposes Kimi-K2.6 via Sail.
Launch directly into any model from the model catalog with
--model:
setup write Claude Code’s availableModels setting so fresh
local sessions show only Sail-backed picker rows. Claude Code concatenates
non-managed availableModels from user, project, local, and temporary settings,
though, so rows from another settings scope may still appear. Rows that name
non-Sail models (for example claude-* IDs) still route to Sail and will not be
served there; remove them from the other settings file or enforce the picker
with managed settings. sail-code prints a warning when it can see those extra
rows.
The launcher does not force a completion window. Claude Code has no flag for
adding request metadata, so requests go out without completion_window and
Sail’s API default applies. To target a different tier for a request, set
metadata.completion_window in the request JSON (the launcher leaves the body
untouched). See Completion windows for the latency/price
tradeoff.
Commit attribution
sail-code setup sets Claude Code’s top-level attribution.commit to a Sail
co-author trailer naming the resolved model —
--model override names
that model in the trailer instead (so a non-default setup isn’t misattributed to
GLM-5.2). attribution.pr is emptied (no PR-body attribution line). setup --revert restores your original attribution from the backup, or removes the
trailer if the settings file was created by sail-code in the first place. This
only affects the persisted settings path — the run launcher itself doesn’t
touch attribution.
Manual configuration
If you’d rather not use the launcher, set the core routing environment yourself (npx @sailresearch/code env prints the full env block, including picker
display metadata):
- Bare host. Claude Code appends
/v1/messagesitself; a/v1base URL would resolve to/v1/v1/messagesand 404. ANTHROPIC_AUTH_TOKEN, notANTHROPIC_API_KEY. Sail authenticates withAuthorization: Bearer; thex-api-keyheader thatANTHROPIC_API_KEYselects is rejected.- Pin
ANTHROPIC_MODELand remap every alias. A saved/modelchoice (or a--resumed session) can otherwise start on an unmappedclaude-*model ID that Sail cannot serve. - Pin
CLAUDE_CODE_SUBAGENT_MODEL. It’s the highest-priority subagent model source, so a value inherited from your shell or a settings file (e.g. aclaude-*ID left over from a prior Anthropic/Bedrock setup) would send every subagent to an unmapped model. Setting it to a Sail model routes all subagents onto GLM. - Declare
_SUPPORTED_CAPABILITIES. Claude Code enables effort levels and extended thinking by matching the model ID against known patterns; a custom ID likezai-org/GLM-5.2-FP8matches none, so/effortand thinking are silently disabled without the declaration. Sail maps both onto GLM’s reasoning. - Unset other providers’ variables. A provider selector such as
CLAUDE_CODE_USE_BEDROCKoutranksANTHROPIC_AUTH_TOKENin Claude Code’s credential precedence, so a leftover export would silently keep routing to that provider instead of Sail; andANTHROPIC_CUSTOM_HEADERSfrom a prior gateway setup would be sent to Sail on every request. The launcher strips these automatically — manually, theunsetline above does the same.
Limitations
- The native Claude Code desktop app reads endpoint routing only from
managed (administrator-distributed) configuration — it cannot be pointed at
Sail with environment variables or
settings.json. Use the terminal or the VS Code extension. - A signed-in Claude apps gateway session (an enterprise/corporate-SSO
deployment) sits outside the normal credential precedence and outranks
ANTHROPIC_AUTH_TOKEN, soclaudekeeps using the gateway and never reaches Sail. This only affects orgs running that gateway — ordinary Pro/Max users don’t have one. If you do, run/logoutfirst, or launch that session withCLAUDE_CONFIG_DIRpointed at an empty directory (note: an isolated config dir won’t see your normal Claude Code settings/MCP servers). - An administrator-managed (MDM / policy)
availableModelsallowlist that excludes the Sail model wins: Claude Code replaces the model at startup (with a warning) and the launcher can’t override a managed allowlist, since managed settings outrank the command-line settings the launcher uses. That’s an enterprise policy — raise it with your admin. (If you setavailableModelsyourself in your ownsettings.json, just include the Sail model id, e.g.zai-org/GLM-5.2-FP8, or drop the restriction.) - Sail is throughput-optimized; long agentic turns can take longer than the Anthropic API. The launcher raises Claude Code’s request timeout and disables its 5-minute stream-idle watchdog (on by default for custom base URLs) so a turn that queues before streaming isn’t aborted mid-flight.
- Subagents run on the main Sail model by default: the launcher pins
CLAUDE_CODE_SUBAGENT_MODEL, which overrides a subagent’s frontmattermodel:field. That makes custom subagents with aclaude-*frontmatter ID work (they route to GLM instead of failing), but it also means per-subagent model choices and--background-modeldon’t apply to subagents — they all use the main model. Override it yourself if you need a specific Sail model for subagents.
Next steps
Models
Browse the catalog for alternative models.
Pricing
Per-token rates by model and completion window.
Completion windows
How the latency-for-price tradeoff works.
Support matrix
What the Anthropic-compatible API supports.