Skip to content

Use Claude Code with amazee.ai

Claude Code is Anthropic's agentic coding tool that works directly in your terminal. By routing it through amazee.ai, you get access to Claude models hosted in your region — with your data staying in your chosen geography and your usage tracked through your amazee.ai workspace.

Why use Claude Code with amazee.ai?

Data residency. Claude Code requests are processed through your regional amazee.ai endpoint. Pick Switzerland, Germany, the US, Australia, or the UK.

Team budget controls. Set spending limits per team, user, and key from my.amazee.io. No surprise invoices.

Usage visibility. All Claude Code activity shows up in your amazee.ai usage dashboard — per key, per user, per team.


Quick start

Step 1 — Install Claude Code

=== "macOS / Linux / WSL"

```bash
curl -fsSL https://claude.ai/install.sh | bash
```

=== "Windows PowerShell"

```powershell
irm https://claude.ai/install.ps1 | iex
```

Step 2 — Get your endpoint and key

Log in at my.amazee.io, go to your workspace, and copy:

  • Your API endpoint: https://llm.[your-region].amazee.ai
  • Your API key

Step 3 — Connect Claude Code to amazee.ai

Add these environment variables to your shell profile (~/.zshrc, ~/.bashrc, or ~/.config/fish/config.fish):

export AMAZEEAI_API_KEY="your-api-key-here"
export ANTHROPIC_BASE_URL="https://llm.[your-region].amazee.ai"
export ANTHROPIC_AUTH_TOKEN="$AMAZEEAI_API_KEY"
export ANTHROPIC_API_KEY=""  # must be explicitly empty

Then reload your shell:

source ~/.zshrc   # or ~/.bashrc

!!! warning "ANTHROPIC_API_KEY must be empty — not unset" Claude Code falls back to direct Anthropic authentication if this variable is unset. Set it to an empty string "" to prevent that.

!!! note "If you were previously logged in to Anthropic" Run /logout inside a Claude Code session to clear cached credentials before the new config takes effect.

Step 4 — Start a session

cd /path/to/your/project
claude

Step 5 — Verify

Run /status inside Claude Code:

> /status
Auth token: ANTHROPIC_AUTH_TOKEN
Anthropic base URL: https://llm.[your-region].amazee.ai

You can also check my.amazee.ioUsage to see requests appearing in real time.


How it works

amazee.ai's API gateway speaks the same protocol as the Anthropic API. When you set ANTHROPIC_BASE_URL, Claude Code routes all requests to your amazee.ai endpoint instead of Anthropic's servers. No local proxy needed.


Configuring models

Claude Code uses different models for different task types. You can pin each role to a specific model:

export ANTHROPIC_DEFAULT_OPUS_MODEL="claude-opus-4"
export ANTHROPIC_DEFAULT_SONNET_MODEL="claude-sonnet-4-5"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="claude-haiku-4-5"
export CLAUDE_CODE_SUBAGENT_MODEL="claude-sonnet-4-5"
Variable Used for
ANTHROPIC_DEFAULT_OPUS_MODEL Complex reasoning tasks
ANTHROPIC_DEFAULT_SONNET_MODEL General coding
ANTHROPIC_DEFAULT_HAIKU_MODEL Quick completions
CLAUDE_CODE_SUBAGENT_MODEL Sub-agents spawned during a session

Add these to the same shell profile as your ANTHROPIC_BASE_URL.

See Available Models for the full list.


GitHub Actions

To use amazee.ai in the Claude Code GitHub Action:

- name: Run Claude Code
  uses: anthropics/claude-code-action@v1
  with:
    anthropic_api_key: ${{ secrets.AMAZEEAI_API_KEY }}
  env:
    ANTHROPIC_BASE_URL: https://llm.[your-region].amazee.ai

Store your key as a GitHub secret named AMAZEEAI_API_KEY.


Troubleshooting

Auth errors / "invalid API key" : Make sure ANTHROPIC_API_KEY is set to "" (empty string), not unset. Run echo $ANTHROPIC_API_KEY — it should print nothing. If it prints a key value, something in your shell config is still setting it.

Requests going to Anthropic instead of amazee.ai : Run /logout in Claude Code, then verify ANTHROPIC_BASE_URL is set correctly with echo $ANTHROPIC_BASE_URL.

Model not found : Check Available Models. Use the exact model ID shown there. Model availability depends on your region and plan.

Context length errors : Break the task into smaller chunks or start a fresh session (/clear).