Eligible new accounts get $0.10 in free API credit. Once per account; abuse limits apply. Create an account

Outrun

How do I point Claude Code at a custom base URL?

Claude Code reads its API address from one setting. Change two values and it works with any Anthropic-compatible API, Outrun included.

Short answer: set ANTHROPIC_BASE_URL to the API address and ANTHROPIC_AUTH_TOKEN to your key, then open a new terminal. For Outrun the address is https://api.outrun.to, with no /v1 on the end.

Fastest way: one setup prompt

Copy this prompt into an AI assistant that can edit files on your computer. It tells the assistant to back up your settings, add the lines for your operating system and leave a KEY placeholder that you fill in yourself.

You can read the prompt first in the setup guide. To do it by hand, follow the steps below.

Set the values by hand

macOS or Linux: add these lines to ~/.zshrc and ~/.bashrc.

export ANTHROPIC_BASE_URL="https://api.outrun.to"
export ANTHROPIC_AUTH_TOKEN="KEY"
export ANTHROPIC_MODEL="claude-opus-5-5"

Windows: run these in PowerShell.

[Environment]::SetEnvironmentVariable("ANTHROPIC_BASE_URL", "https://api.outrun.to", "User")
[Environment]::SetEnvironmentVariable("ANTHROPIC_AUTH_TOKEN", "KEY", "User")
[Environment]::SetEnvironmentVariable("ANTHROPIC_MODEL", "claude-opus-5-5", "User")
  • Replace KEY with your own key. Keep it out of AI chats and screenshots.
  • Remove any ANTHROPIC_API_KEY setting. Having both set causes an authentication conflict.
  • Close every terminal and editor window, then open a new one.

Check it worked

  1. Run claude. If you are signed in with an Anthropic account, run /logout first.
  2. Run /status. It shows the base URL in use and the current model.
  3. Send "Reply with OK only." A short reply with no connection error means it works. The test uses a little credit.

Set a model for each slot

Claude Code has an Opus, a Sonnet and a Haiku slot. Point each one at a model your API serves. On Windows, set the same three names in PowerShell.

export ANTHROPIC_DEFAULT_OPUS_MODEL="claude-opus-5-5"
export ANTHROPIC_DEFAULT_SONNET_MODEL="claude-sonnet-5-5"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="claude-haiku-5-5"

Switch during a session with /model and the model ID. Prices for every model. To estimate a day of your own usage, use the Claude Code cost calculator.

Usual errors

  • 401 or invalid key: the key is mistyped, or ANTHROPIC_API_KEY is still set.
  • 404 or 400: the base URL has /v1 or /messages added, or the model ID is wrong.
  • 402: check your balance and the key's spending cap.

Go back to your Anthropic account

Remove the lines you added and open a new terminal. If Claude Code does not pick up your saved login, run /login.

Step-by-step version for Windows, macOS and Linux: Claude Code setup guide. No key yet? Get an API key.

← All posts