Connect AI1API to Claude Code

Claude Code uses the Anthropic Messages protocol. Use Anthropic endpoint variables instead of the Codex config.toml format.

Prerequisites

  • Claude Code is installed
  • An API Key exists
  • Claude Code meets the current upstream minimum version

Setup steps

Step 1: Set the endpoint and key

Use shell variables on macOS/Linux. On Windows PowerShell, use the $env: syntax. Prefer the endpoint shown by the console Use API Key dialog.

macOS/Linux
export ANTHROPIC_BASE_URL="https://ai1api.com/v1"
export ANTHROPIC_AUTH_TOKEN="sk-your-key"
export CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC="1"

Step 2: Start Claude Code

Open a new terminal, run claude, and send a short prompt. If it reports that the client is too old, upgrade Claude Code and retry.

Verify the connection

Start with the smallest request, then enable streaming and tools after the connection works.

Verification
claude

Notes

  • Claude Code uses /v1/messages; do not replace it with /v1/chat/completions.
  • Keep the API key in local environment variables or a generated config file.