DEVSAIO

How to use Claude Code with a custom API (ANTHROPIC_BASE_URL)

Point Claude Code at DEVSAIO with three environment variables, choose which Claude models it uses, and pay per request instead of a subscription.

DEVSAIO team · 2 min read
Share on X

Claude Code is Anthropic's coding agent for the terminal. It reads a few environment variables that let you send its requests to any Anthropic-compatible endpoint, including DEVSAIO.

The three variables that matter

VariableValue
ANTHROPIC_BASE_URLhttps://devsaio.lol
ANTHROPIC_AUTH_TOKENyour DEVSAIO API key
ANTHROPIC_MODELthe main model, e.g. claude-sonnet-4-6

macOS / Linux

bash
export ANTHROPIC_BASE_URL=https://devsaio.lol
export ANTHROPIC_AUTH_TOKEN=YOUR_KEY
export ANTHROPIC_MODEL=claude-sonnet-4-6
claude

Add the export lines to ~/.zshrc or ~/.bashrc to make them permanent.

Windows (PowerShell)

powershell
$env:ANTHROPIC_BASE_URL = "https://devsaio.lol"
$env:ANTHROPIC_AUTH_TOKEN = "YOUR_KEY"
$env:ANTHROPIC_MODEL = "claude-sonnet-4-6"
claude

Or use the settings file

Claude Code also reads an env block from ~/.claude/settings.json, which keeps the setup out of your shell profile:

json
{
  "env": {
    "ANTHROPIC_BASE_URL": "https://devsaio.lol",
    "ANTHROPIC_AUTH_TOKEN": "YOUR_KEY",
    "ANTHROPIC_MODEL": "claude-sonnet-4-6",
    "ANTHROPIC_DEFAULT_OPUS_MODEL": "claude-opus-4-7",
    "ANTHROPIC_DEFAULT_HAIKU_MODEL": "claude-haiku-4-5"
  }
}

The DEFAULT_OPUS and DEFAULT_HAIKU variables control which models Claude Code uses when it switches to a bigger or smaller model for certain steps.

Check it works

Start claude in a project folder and ask something simple, like “what does this repo do?”. Then open Usage Logs in your dashboard: you should see the requests and their cost.

Keeping costs under control

Agents read a lot of files, so token use adds up. Three habits help:

  • Give the key a monthly limit so a runaway session can't drain your balance.
  • Use a smaller model (like claude-haiku-4-5) for simple tasks.
  • Start a fresh session (/clear) when you switch tasks; long sessions resend more context.

The integrations page generates these settings with your key filled in. More tips: a Claude Code workflow that saves tokens.

Try it with one API key

Claude, GPT, Gemini, DeepSeek, image and video models through one OpenAI- and Anthropic-compatible endpoint. Prepaid, pay only for what you use.

Keep reading