Setting up Claude Code, opencode, Cline, Continue and Aider, choosing a model for code, and keeping costs under control.
AI coding tools run inside your editor and get their help from a language model. DaLAi supplies that model; the tool itself stays the same.
Claude Code is Anthropic's own command-line tool, and it works with DaLAi. Its setup differs from the other tools on this page: you do not enter the address and key in the app's settings; instead, you set three environment variables.
In Windows PowerShell:
$env:ANTHROPIC_BASE_URL="https://dalai.ir"
$env:ANTHROPIC_AUTH_TOKEN="sk-YOUR-KEY"
$env:ANTHROPIC_MODEL="claude-sonnet-4-5"
claude
On macOS and Linux:
export ANTHROPIC_BASE_URL=https://dalai.ir
export ANTHROPIC_AUTH_TOKEN=sk-YOUR-KEY
export ANTHROPIC_MODEL=claude-sonnet-4-5
claude
Three points; if any of them is missed, it will not work:
/v1 to the address. Unlike every other tool on this page, give only https://dalai.ir here. The tool completes the path itself.ANTHROPIC_AUTH_TOKEN, not in ANTHROPIC_API_KEY. A DaLAi key is a bearer token.ANTHROPIC_MODEL. Without it, the tool sends its own dated model name, such as claude-sonnet-4-5-20250929, while we sell models under their short names. The result is the error No available channel for model.If you want the tool's auxiliary tasks to work properly too, also add ANTHROPIC_DEFAULT_HAIKU_MODEL=claude-haiku-4-5. Claude Code calls a small model for its own lightweight tasks, and that model's default name is dated as well, so without this variable you get the same error as above.
The first message of every session is expensive. Before it even gets to your task, Claude Code sends a system prompt of about 35,000 tokens. In our test, a short session with just a single file read took nearly half a dollar from the balance. Do not start with a balance close to zero, and after your first session, check your actual cost in Usage Logs.
A VS Code extension that can read files, modify them and run commands.
https://dalai.ir/v1For VS Code and JetBrains. In config.yaml:
models:
- name: DaLAi
provider: openai
apiBase: https://dalai.ir/v1
apiKey: sk-YOUR-KEY
model: claude-sonnet-4-5
A command-line tool that works directly with git:
aider --openai-api-base https://dalai.ir/v1 \
--openai-api-key sk-YOUR-KEY \
--model claude-sonnet-4-5
An open-source command-line coding tool that reads files, modifies them and runs commands. It has been tested with this service: version 1.18 read a local file with its own tool and gave the correct answer.
Install it with npm (other methods are on the opencode website). On Windows, opencode itself recommends running it in WSL.
npm i -g opencode-ai
Then create the opencode.json file, either in the project root or, for all projects, at ~/.config/opencode/opencode.json:
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"dalai": {
"npm": "@ai-sdk/openai-compatible",
"name": "DaLAi",
"options": {
"baseURL": "https://dalai.ir/v1",
"apiKey": "{env:DALAI_API_KEY}"
},
"models": {
"claude-sonnet-4-5": { "name": "Claude Sonnet 4.5" },
"claude-haiku-4-5": { "name": "Claude Haiku 4.5" }
}
}
},
"model": "dalai/claude-sonnet-4-5"
}
Put the key in the DALAI_API_KEY environment variable and run opencode. In Windows PowerShell:
$env:DALAI_API_KEY="sk-YOUR-KEY"
opencode
On macOS and Linux:
export DALAI_API_KEY=sk-YOUR-KEY
opencode
/v1 is required. Unlike Claude Code, the address must end with /v1.models, under the same name that appears in the model list. Inside the app, switch between them with the /models command.model, the provider name (dalai) and the model name are joined with a /.At every step, opencode also sends its system prompt and its tool definitions. In our test, each step had about 8,000 input tokens before any file from the project was added to it. Check the actual cost in Usage Logs.
claude-sonnet-4-5. It strikes a good balance between accuracy and cost.qwen3-coder-* or haiku models. They are good enough for small, repetitive changes and much cheaper.The practical approach: start with a mid-sized model and move up only when you get stuck. The opposite, always staying on the most expensive model, is the biggest waste of money in coding.
Coding tools also send the contents of your files to the model. A simple question about one function can carry several thousand input tokens, because the whole file goes along with it. In agent mode, where the tool works through several steps in a row, this repeats at every step.
Ways to reduce the cost:
A full explanation of how costs are calculated is in Wallet, top-ups and billing.