Skip to content

Configure Claude Code Model Provider ​

This setup uses environment variables only. It does not require CC Switch or another provider-management interface.

Get an API key first

Open the LAYSO AI website ↗, sign in or create an account, create an API key in the dashboard, and then return here to continue.

Connection values ​

SettingValue
ProtocolAnthropic compatible
Base URLhttps://api.layso.ai
Key variableANTHROPIC_AUTH_TOKEN
Key sourceLAYSO AI dashboard ↗

Temporary setup ​

bash
export ANTHROPIC_BASE_URL="https://api.layso.ai"
export ANTHROPIC_AUTH_TOKEN="$LAYSO_API_KEY"
claude

Keep LAYSO_API_KEY in secure local storage. Never commit a real key to a repository.

Persistent setup ​

zsh ​

bash
echo 'export ANTHROPIC_BASE_URL="https://api.layso.ai"' >> ~/.zshrc
echo 'export ANTHROPIC_AUTH_TOKEN="$LAYSO_API_KEY"' >> ~/.zshrc
source ~/.zshrc

Bash ​

bash
echo 'export ANTHROPIC_BASE_URL="https://api.layso.ai"' >> ~/.bashrc
echo 'export ANTHROPIC_AUTH_TOKEN="$LAYSO_API_KEY"' >> ~/.bashrc
source ~/.bashrc

Windows PowerShell ​

For the current window:

powershell
$env:ANTHROPIC_BASE_URL = "https://api.layso.ai"
$env:ANTHROPIC_AUTH_TOKEN = $env:LAYSO_API_KEY
claude

Persist for the current user:

powershell
[Environment]::SetEnvironmentVariable("ANTHROPIC_BASE_URL", "https://api.layso.ai", "User")
[Environment]::SetEnvironmentVariable("ANTHROPIC_AUTH_TOKEN", $env:LAYSO_API_KEY, "User")

Reopen PowerShell and your editor after saving the variables.

Verify the setup ​

bash
printf 'Base URL: %s\n' "$ANTHROPIC_BASE_URL"
test -n "$ANTHROPIC_AUTH_TOKEN" && echo 'Auth token: configured' || echo 'Auth token: missing'

Test the Anthropic route directly:

bash
curl https://api.layso.ai/models \
  -H "x-api-key: $ANTHROPIC_AUTH_TOKEN" \
  -H "anthropic-version: 2023-06-01"

Start Claude Code and run /status inside the session.

Select a model ​

One LAYSO AI API key can access platform models. Successful requests have itemized charges based on the selected model's current price; failed tasks are not charged. Copy exact model IDs from the dashboard.

Authentication troubleshooting ​

ErrorResolution
401 / 403Reload the shell and verify the LAYSO AI key in ANTHROPIC_AUTH_TOKEN
404Set the Base URL to https://api.layso.ai without any extra path
Unknown modelUse the exact model ID from the dashboard
Editor still uses the old endpointFully restart the editor

Next step ​

Optionally configure CCometixLine or create Claude Code Skills.

LAYSO AI API 文档