Claude Code CLI
Set up Claude Code to call supported Ship models through Thesean's Anthropic-compatible Messages API.
Prerequisites
Ensure you have Claude Code installed. See the Claude Code quickstart for more options, or use one of the following:
curl -fsSL https://claude.ai/install.sh | bash
Configuration
Use the bare origin https://api.thesean.ai. Claude Code appends /v1/messages to
ANTHROPIC_BASE_URL. Because Thesean keys use Bearer authentication, configure
ANTHROPIC_AUTH_TOKEN, not ANTHROPIC_API_KEY.
Choose one of the following configuration methods:
Option 1: Global Configuration
Create or edit ~/.claude/settings.json. This configuration applies to Claude Code in every
project:
{
"env": {
"ANTHROPIC_BASE_URL": "https://api.thesean.ai",
"ANTHROPIC_AUTH_TOKEN": "sk-your-thesean-key",
"ANTHROPIC_MODEL": "ship-like/claude-sonnet-5",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "ship-like/claude-haiku-4-5",
"ANTHROPIC_SMALL_FAST_MODEL": "ship-like/claude-haiku-4-5"
}
}
Replace sk-your-thesean-key with your key from the Thesean Dashboard.
To use Opus instead, set ANTHROPIC_MODEL to ship-like/claude-opus-4-8 and restart Claude Code.
The built-in /model entries use bare model IDs that Thesean does not serve.
ANTHROPIC_MODEL sets the main model. Claude Code uses a separate Haiku-tier model for background
work and some subagents. Set ANTHROPIC_DEFAULT_HAIKU_MODEL so those requests use Thesean;
ANTHROPIC_SMALL_FAST_MODEL provides compatibility with older Claude Code versions.
ANTHROPIC_MODEL sets the main model. Claude Code uses a separate Haiku-tier model for background
work and some subagents. Set ANTHROPIC_DEFAULT_HAIKU_MODEL so those requests use Thesean;
ANTHROPIC_SMALL_FAST_MODEL provides compatibility with older Claude Code versions.
CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY adds Thesean's ship-like/ models to the /model
picker in Claude Code 2.1.129 and later.
Claude Code does not expand ${VARIABLE} references inside the env block. Enter the credential
directly, export it in your shell as shown below, or use Claude Code's apiKeyHelper with a secret
manager. Never commit a settings file containing a key.
Credentials entered directly in settings files or shell commands are stored in plaintext and may appear in local shell or Claude Code history. Prefer a secret manager for shared machines, and rotate any key exposed during setup.
Option 2: Shell Environment
Export the values before starting Claude Code:
export ANTHROPIC_BASE_URL="https://api.thesean.ai"
export ANTHROPIC_AUTH_TOKEN="sk-your-thesean-key"
export ANTHROPIC_MODEL="ship-like/claude-sonnet-5"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="ship-like/claude-haiku-4-5"
export ANTHROPIC_SMALL_FAST_MODEL="ship-like/claude-haiku-4-5"
claude
Add the exports to your shell profile if you want new terminal sessions to inherit them.
Option 3: Secret Manager or Rotating Key
Use Claude Code's apiKeyHelper when your key is stored in a secret manager or rotates
automatically. The helper command must print only the current key to standard output.
For example, with the 1Password CLI:
{
"apiKeyHelper": "op read 'op://Private/Thesean API Key/credential'",
"env": {
"ANTHROPIC_BASE_URL": "https://api.thesean.ai",
"ANTHROPIC_MODEL": "ship-like/claude-sonnet-5",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "ship-like/claude-haiku-4-5",
"ANTHROPIC_SMALL_FAST_MODEL": "ship-like/claude-haiku-4-5"
}
}
Replace the op read command with the equivalent command for your secret manager. Do not also set
ANTHROPIC_AUTH_TOKEN; Claude Code uses the helper output as the request credential and refreshes
it periodically or after an HTTP 401 response.
apiKeyHelper runs through /bin/sh, which does not load ~/.zshrc or ~/.bashrc. The helper
must be a self-contained command that can authenticate to the secret manager without relying on a
shell-profile export.
Verify Your Setup
Confirm your credential and model with a direct Messages request:
curl https://api.thesean.ai/v1/messages \
-H "Authorization: Bearer sk-your-thesean-key" \
-H "Content-Type: application/json" \
-d '{
"model": "ship-like/claude-sonnet-5",
"max_tokens": 16,
"messages": [{"role": "user", "content": "Hello"}]
}'
After a successful response, fully quit and relaunch Claude Code, then run /status to confirm the
base URL and credential source. Claude Code reads these environment settings only when it starts.
Troubleshooting
- Claude Code asks you to log in: Ensure
ANTHROPIC_AUTH_TOKENis available before first-run setup. Global~/.claude/settings.jsonis the most reliable location. - A settings change is not reflected: Restart Claude Code. In particular, confirm
ANTHROPIC_MODELwas loaded when the session started. apiKeyHelpercannot find a shell variable: Helpers run through/bin/shand do not load~/.zshrcor~/.bashrc. Use a self-contained secret-manager command rather than relying on a shell-profile export.- A bare Claude model returns 404: Set
ANTHROPIC_MODELto a full Ship model ID such asship-like/claude-opus-4-8, then restart Claude Code. - Ship models do not appear in
/model: Claude Code's gateway discovery ignores model IDs that do not begin withclaudeoranthropic, including Thesean'sship-like/IDs. Choose the model withANTHROPIC_MODELinstead of selecting a built-in entry from the picker. - A 1M-context model fails: Thesean supports
ship-like/claude-opus-4-8[1m]. Ensure the selected model has theship-like/prefix; a bare built-in model ID does not route through Ship. - A background task or subagent requests an unavailable Haiku model: Set
ANTHROPIC_DEFAULT_HAIKU_MODELtoship-like/claude-haiku-4-5. On older Claude Code versions, also setANTHROPIC_SMALL_FAST_MODELto the same value. - A direct request returns 401: Recheck the key and ensure it is sent as
Authorization: Bearer. - A direct request returns 402: Add credits in the Thesean Dashboard.
- A feature requests an unavailable model: Some Claude Code features select a model tier
independently of
ANTHROPIC_MODEL. Configure the correspondingANTHROPIC_DEFAULT_<TIER>_MODELoverride with a supportedship-like/model.