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.
- Install Claude Code.
- Keep the key in your shell profile.
- Write the settings file.
- Check the connection.
- Share the setup with your team.
1. Install Claude Code
| On | Install line |
|---|---|
| macOS, Linux, WSL | curl -fsSL https://claude.ai/install.sh | bash |
| Windows, PowerShell | irm https://claude.ai/install.ps1 | iex |
| any, with Node 22 or later | npm 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:
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 →.
{
"$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"
}| Setting | Holds |
|---|---|
ANTHROPIC_BASE_URL | the address, without /v1: Claude Code sends each request to POST /v1/messages |
ANTHROPIC_DEFAULT_OPUS_MODEL | the model behind opus in /model |
ANTHROPIC_DEFAULT_SONNET_MODEL | the model behind sonnet in /model |
ANTHROPIC_DEFAULT_HAIKU_MODEL | the model behind haiku, which also runs background work such as a session's title |
CLAUDE_CODE_SUBAGENT_MODEL | the model each subagent runs on |
model | the 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 put your key in .claude/settings.json inside a project. That file is committed, and the key goes with it.
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:
claude -p "Name this project's main language in one word." --model sonnetIt 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.
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
| Status | Means | Do |
|---|---|---|
| 401 | no key reached Claude Code | check ANTHROPIC_AUTH_TOKEN is set in the terminal Claude Code starts from |
| 402 | the 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 spent | make a depositDepositMoney entering your balance, by CIB or Edahabia card.More on Balance and charges →, or raise the cap |
| 404 | a model ID not on sale, often one of Claude Code's own names such as claude-sonnet-4-5 | set every model variable in step 3 to an anthropic/ ID from Models |
| 400 | the body names the anthropic-beta header, or reads Extra inputs are not permitted | add "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