Skip to main content
Claude Code speaks the Anthropic Messages API to whatever endpoint 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:
npm install -g @anthropic-ai/claude-code   # once
npx @sailresearch/code
On first run — unless you already have 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:
npx @sailresearch/code --trusted
--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 --:
npx @sailresearch/code -- --resume

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:
npx @sailresearch/code setup            # writes ~/.claude/settings.json (backed up first)
npx @sailresearch/code setup --revert   # restores your original settings
Extension sessions read that env block, but the extension’s own pre-launch login check does not. If you don’t have a saved Anthropic login, also add the routing to VS Code’s user settings (Preferences: Open User Settings (JSON)) and reload the window — the setup command prints this snippet:
"claudeCode.disableLoginPrompt": true,
"claudeCode.environmentVariables": [
  { "name": "ANTHROPIC_BASE_URL", "value": "https://api.sailresearch.com" },
  { "name": "ANTHROPIC_AUTH_TOKEN", "value": "<your SAIL_API_KEY>" }
]
Reload the extension after configuring. Use 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:
npx @sailresearch/code --model moonshotai/Kimi-K2.6
The launcher and 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 —
Co-Authored-By: GLM-5.2 via Sail <noreply@sailresearch.com>
— so commits and PRs the agent makes are attributed to the Sail-served model instead of Anthropic’s default model-derived trailer. A --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):
export ANTHROPIC_BASE_URL="https://api.sailresearch.com"   # bare host — Claude Code appends /v1/messages
export ANTHROPIC_AUTH_TOKEN="$SAIL_API_KEY"                # bearer auth; do NOT use ANTHROPIC_API_KEY
export ANTHROPIC_MODEL="zai-org/GLM-5.2-FP8"               # pins startup over a saved /model choice
export ANTHROPIC_DEFAULT_OPUS_MODEL="zai-org/GLM-5.2-FP8"
export ANTHROPIC_DEFAULT_SONNET_MODEL="zai-org/GLM-5.2-FP8"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="zai-org/GLM-5.2-FP8"
export ANTHROPIC_DEFAULT_FABLE_MODEL="zai-org/GLM-5.2-FP8"
export ANTHROPIC_CUSTOM_MODEL_OPTION="moonshotai/Kimi-K2.6"
export ANTHROPIC_CUSTOM_MODEL_OPTION_NAME="Kimi-K2.6 via Sail"
export CLAUDE_CODE_SUBAGENT_MODEL="zai-org/GLM-5.2-FP8"     # pins subagents too; overrides frontmatter + any inherited value
export ANTHROPIC_DEFAULT_OPUS_MODEL_SUPPORTED_CAPABILITIES="effort,thinking"    # custom model IDs match no known
export ANTHROPIC_DEFAULT_SONNET_MODEL_SUPPORTED_CAPABILITIES="effort,thinking"  # pattern, so effort + extended
export ANTHROPIC_DEFAULT_HAIKU_MODEL_SUPPORTED_CAPABILITIES="effort,thinking"   # thinking would be silently
export ANTHROPIC_DEFAULT_FABLE_MODEL_SUPPORTED_CAPABILITIES="effort,thinking"   # disabled without these
export ANTHROPIC_CUSTOM_MODEL_OPTION_SUPPORTED_CAPABILITIES="effort,thinking,xhigh_effort"
export API_TIMEOUT_MS="3000000"
export API_FORCE_IDLE_TIMEOUT="0"                          # off: else a 5-min stream-idle watchdog (on for custom base URLs) aborts long-queued turns
export ENABLE_TOOL_SEARCH="false"                          # tool search needs tool_reference expansion Sail doesn't serve
# Clear leftovers from other provider setups — selectors outrank
# ANTHROPIC_AUTH_TOKEN, and stale custom headers would be sent to Sail:
unset CLAUDE_CODE_USE_BEDROCK CLAUDE_CODE_USE_VERTEX CLAUDE_CODE_USE_FOUNDRY \
  CLAUDE_CODE_USE_MANTLE CLAUDE_CODE_USE_ANTHROPIC_AWS ANTHROPIC_CUSTOM_HEADERS
claude
Three details that matter:
  • Bare host. Claude Code appends /v1/messages itself; a /v1 base URL would resolve to /v1/v1/messages and 404.
  • ANTHROPIC_AUTH_TOKEN, not ANTHROPIC_API_KEY. Sail authenticates with Authorization: Bearer; the x-api-key header that ANTHROPIC_API_KEY selects is rejected.
  • Pin ANTHROPIC_MODEL and remap every alias. A saved /model choice (or a --resumed session) can otherwise start on an unmapped claude-* 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. a claude-* 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 like zai-org/GLM-5.2-FP8 matches none, so /effort and 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_BEDROCK outranks ANTHROPIC_AUTH_TOKEN in Claude Code’s credential precedence, so a leftover export would silently keep routing to that provider instead of Sail; and ANTHROPIC_CUSTOM_HEADERS from a prior gateway setup would be sent to Sail on every request. The launcher strips these automatically — manually, the unset line 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, so claude keeps 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 /logout first, or launch that session with CLAUDE_CONFIG_DIR pointed at an empty directory (note: an isolated config dir won’t see your normal Claude Code settings/MCP servers).
  • An administrator-managed (MDM / policy) availableModels allowlist 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 set availableModels yourself in your own settings.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 frontmatter model: field. That makes custom subagents with a claude-* frontmatter ID work (they route to GLM instead of failing), but it also means per-subagent model choices and --background-model don’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.