Claude Code

Claude Code, Anthropic's terminal coding agent, connects to ozeye through two environment variables. It keeps speaking its native Anthropic protocol; ozeye serves it on open models with tool use, thinking and prompt caching intact.

Install

curl -fsSL https://claude.ai/install.sh | bash     # macOS, Linux, WSL
# or: npm install -g @anthropic-ai/claude-code   (Node 18+)
# Windows PowerShell: irm https://claude.ai/install.ps1 | iex

Configure

Add these to your shell profile. The order matters: ANTHROPIC_AUTH_TOKEN expands when the file is sourced, so the ozeye key must be defined above it.

# ~/.zshrc or ~/.bashrc
export OZEYE_API_KEY="oz_your_key_here"
export ANTHROPIC_BASE_URL="https://ozeye.ai"
export ANTHROPIC_AUTH_TOKEN="$OZEYE_API_KEY"   # must come AFTER OZEYE_API_KEY
export ANTHROPIC_API_KEY=""                    # clears a stale Anthropic key
export CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY=1
export ANTHROPIC_DEFAULT_OPUS_MODEL="glm-5.3"
export ANTHROPIC_DEFAULT_SONNET_MODEL="deepseek-v4.1-flash"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="deepseek-v4-flash-0731"

Reload the shell (source ~/.zshrc or open a new terminal). Prefer a settings file? The same keys go under env:

// .claude/settings.local.json (project) or ~/.claude/settings.json (user)
{
  "env": {
    "ANTHROPIC_BASE_URL": "https://ozeye.ai",
    "ANTHROPIC_AUTH_TOKEN": "oz_your_key_here",
    "ANTHROPIC_API_KEY": "",
    "CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY": "1",
    "ANTHROPIC_DEFAULT_SONNET_MODEL": "deepseek-v4.1-flash",
    "ANTHROPIC_DEFAULT_HAIKU_MODEL": "deepseek-v4-flash-0731"
  }
}
Signed in to Claude Code with an Anthropic account before? Run /logout once, otherwise the cached session takes precedence and requests never reach ozeye.

Run and verify

cd /path/to/project && claude
# inside Claude Code:
/status     # Auth token: ANTHROPIC_AUTH_TOKEN, Base URL: https://ozeye.ai
/model      # lists ozeye models when gateway model discovery is on

Requests appear in Dashboard → Logs as they happen.

Models

Claude Code asks for its stock claude-opus-*, claude-sonnet-* and claude-haiku-* ids unless told otherwise. ozeye maps those to the tier defaults (glm-5.3, deepseek-v4.1-flash, deepseek-v4-flash-0731), so it works before you set anything. To choose explicitly:

export ANTHROPIC_DEFAULT_OPUS_MODEL="glm-5.3"
export ANTHROPIC_DEFAULT_SONNET_MODEL="deepseek-v4.1-flash"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="deepseek-v4-flash-0731"
export CLAUDE_CODE_SUBAGENT_MODEL="deepseek-v4-flash-0731"
# 1M-context models: append [1m] so Claude Code does not compact at 200k
export ANTHROPIC_DEFAULT_SONNET_MODEL="deepseek-v4.1-flash[1m]"

Claude Code assumes a 200k context window unless the model name ends in [1m]; ozeye strips the suffix. With CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY=1 the /model picker reads GET /v1/models and shows the models that carry an Anthropic family tier.

Agent SDK and GitHub Actions

The Claude Agent SDK runs on Claude Code, so the same environment variables connect it. For the GitHub Action, the anthropic_api_key input is required to start the action; the environment does the routing:

- name: Run Claude Code
  uses: anthropics/claude-code-action@v1
  with:
    anthropic_api_key: \$\{{ secrets.OZEYE_API_KEY }}
  env:
    ANTHROPIC_BASE_URL: https://ozeye.ai
    ANTHROPIC_AUTH_TOKEN: \$\{{ secrets.OZEYE_API_KEY }}
    ANTHROPIC_DEFAULT_SONNET_MODEL: deepseek-v4.1-flash

Troubleshooting

  • 401 authentication_error: the key is not in ANTHROPIC_AUTH_TOKEN, or ANTHROPIC_API_KEY still holds an old Anthropic key. Set it to an empty string and reload the shell.
  • Model not found: a cached Anthropic login is winning. Run /logout, relaunch, check /status.
  • 402 permission_error: balance or key spend limit. Top up in Billing or raise the key limit.
  • Context meter stuck at 200k: append [1m] to the model id; glm-5.3, glm-5.3-flash, deepseek-v4.1-flash and deepseek-v4-flash-0731 have a 1M context.
  • Web fetch blocked inside the sandbox: add "sandbox": {"enableWeakerNetworkIsolation": true} to .claude/settings.json.

Protocol details, what is translated and what is ignored: Anthropic Messages API.