Skip to content

Claude Code

Claude Code can use an Anthropic-compatible gateway. Configure the gateway URL as R9S and authenticate with your R9S API key.

Terminal window
export R9S_API_KEY="<R9S_API_KEY>"
export ANTHROPIC_BASE_URL="https://api.r9s.ai/"
export ANTHROPIC_AUTH_TOKEN="$R9S_API_KEY"

If your local Claude Code setup expects an API key variable instead of a bearer token variable, use:

Terminal window
export ANTHROPIC_API_KEY="$R9S_API_KEY"
Terminal window
claude --model claude-sonnet-4.5

You can also use any Anthropic-compatible model available in your R9S account, such as:

Terminal window
claude --model claude-opus-4.5

Add the same variables to your shell profile if you want Claude Code to use R9S by default:

Terminal window
export R9S_API_KEY="<R9S_API_KEY>"
export ANTHROPIC_BASE_URL="https://api.r9s.ai/"
export ANTHROPIC_AUTH_TOKEN="$R9S_API_KEY"

Restart your shell after updating the profile.

SymptomCheck
Authentication errorConfirm that ANTHROPIC_AUTH_TOKEN or ANTHROPIC_API_KEY contains your R9S API key.
Model not foundConfirm the model name in the R9S console or call /v1/models.
Requests still go to Anthropic directlyConfirm ANTHROPIC_BASE_URL is exported in the same shell session that starts Claude Code.