opendunes
Coding agents
Copy page ▾

Claude Code

Set Claude Code up on OpenDunes once, for every session and every project.

Coding agents points Claude Code at OpenDunes for one terminal. This recipe makes it stay: the key in your shell profile, the address and the models in Claude Code's own settings file.

  1. Install Claude Code.
  2. Keep the key in your shell profile.
  3. Write the settings file.
  4. Check the connection.
  5. Share the setup with your team.

1. Install Claude Code

OnInstall line
macOS, Linux, WSLcurl -fsSL https://claude.ai/install.sh | bash
Windows, PowerShellirm https://claude.ai/install.ps1 | iex
any, with Node 22 or laternpm install -g @anthropic-ai/claude-code

Run claude --version to see it answer.

2. Keep the key in your shell profile

Create an API keyAPI keyThe key you create and send with every request that calls a model.More on API keys → for Claude Code alone, and cap it on API Keys: an agent sends many requests for one task, and the cap stops this key alone (API keys shows how). Then add two lines to ~/.zshrc, or ~/.bashrc:

Shell
export OPENDUNES_API_KEY="…"
export ANTHROPIC_AUTH_TOKEN="$OPENDUNES_API_KEY"

ANTHROPIC_AUTH_TOKEN is the variable Claude Code sends as Authorization: Bearer. Open a new terminal, so both are set.

3. Write the settings file

Claude Code reads ~/.claude/settings.json in every project. Its env block sets the address and one model for each of Claude Code's roles. Claude Code runs on Claude models only: each value is an anthropic/ model IDModel IDThe name a request calls a model by, lab/model, copied from Models.More on Models →.

JSON
{
  "$schema": "https://json.schemastore.org/claude-code-settings.json",
  "env": {
    "ANTHROPIC_BASE_URL": "https://opendunes.com",
    "ANTHROPIC_DEFAULT_OPUS_MODEL": "anthropic/claude-opus-5.5",
    "ANTHROPIC_DEFAULT_SONNET_MODEL": "anthropic/claude-sonnet-4.5",
    "ANTHROPIC_DEFAULT_HAIKU_MODEL": "anthropic/claude-haiku-4.5",
    "CLAUDE_CODE_SUBAGENT_MODEL": "anthropic/claude-sonnet-4.5"
  },
  "model": "sonnet"
}
SettingHolds
ANTHROPIC_BASE_URLthe address, without /v1: Claude Code sends each request to POST /v1/messages
ANTHROPIC_DEFAULT_OPUS_MODELthe model behind opus in /model
ANTHROPIC_DEFAULT_SONNET_MODELthe model behind sonnet in /model
ANTHROPIC_DEFAULT_HAIKU_MODELthe model behind haiku, which also runs background work such as a session's title
CLAUDE_CODE_SUBAGENT_MODELthe model each subagent runs on
modelthe role a session starts on

Switch roles in a session with /model: opus for a hard change, sonnet for the day's work. Each model is charged at its own rate: its page in Models shows it.

Don't

Don't put your key in .claude/settings.json inside a project. That file is committed, and the key goes with it.

Do

Keep the key in your shell profile, as in step 2, and only the address and the models in a settings file.

4. Check the connection

Start Claude Code in your project and run /status. It shows the Anthropic base URL, https://opendunes.com, and an auth token as the credential. A line naming a Claude account instead means a saved login won: run /logout, then start claude again.

To check from the terminal alone, send one short task:

Shell
claude -p "Name this project's main language in one word." --model sonnet

It answers in one line and exits. The request is on Activity, in the app, with its charge in DADAThe Algerian dinar, the one currency the docs show.More on Balance and charges →.

5. Share the setup with your team

Commit the address and the models as .claude/settings.json in the project: the same env block as step 3, without a key. Everyone who clones the project runs Claude Code on OpenDunes with the same models, each on their own key, from their own shell profile.

A setting in .claude/settings.local.json overrides the shared one for you alone, and Claude Code keeps that file out of git.

Watch out

A value in a settings file's env block wins over the same variable exported in your shell. To try another model for one session, use /model or --model, not an export.

Errors

StatusMeansDo
401no key reached Claude Codecheck ANTHROPIC_AUTH_TOKEN is set in the terminal Claude Code starts from
402the balanceBalanceWhat you can spend, in DA.More on Balance and charges → is at zero or below, cannot pay the request's hold, or the key's cap is spentmake a depositDepositMoney entering your balance, by CIB or Edahabia card.More on Balance and charges →, or raise the cap
404a model ID not on sale, often one of Claude Code's own names such as claude-sonnet-4-5set every model variable in step 3 to an anthropic/ ID from Models
400the body names the anthropic-beta header, or reads Extra inputs are not permittedadd "CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS": "1" to the env block

Every other status: Errors and retries.

Next: Claude Desktop · Automatic code review

Last modified on