Configure OpenCode to use OpenDunes as its model provider, billed in DA.
OpenCode is an open-source, terminal-based coding agent with full support for custom OpenAI-compatible endpoints. Pointing it at OpenDunes takes one config change and gives you access to any model in the catalog, billed in Algerian Dinars.
OpenCode picks up the standard OpenAI base URL and key variables:
Add these to your shell profile for a permanent setup:
OpenCode also reads a opencode.json config file. Create or update it in your home directory or project root:
The ${OPENDUNES_API_KEY} syntax reads from your environment at runtime — your key never sits in plain text in the config file.
Pass a model flag when invoking OpenCode, or set it in opencode.json. Use the provider/model slug from the OpenDunes catalog:
Models with the tools capability work best with OpenCode's agentic loop (file reads, writes, shell execution). Check the models page for the capability filter.
OpenCode should list directory contents by invoking a shell tool, then return the summary. Check Dashboard → Analytics to confirm the request was routed through OpenDunes.
OpenCode agentic sessions can generate many sequential requests. Create a dedicated key with a spend cap to keep costs predictable:
opencode, set a budget (e.g., 400 DA = 4,000,000 micro-DA).OPENAI_API_KEY.When the budget is exhausted, OpenCode will receive 402 insufficient_credits and halt. Raise the cap or add DA to continue.
| Symptom | Likely cause | Fix |
|---|---|---|
401 invalid_api_key | OPENAI_API_KEY not set in the current shell | Re-export the variable |
404 model_not_found | Wrong slug format | Use provider/model format (e.g., openai/gpt-5.4) |
OpenCode ignores OPENAI_BASE_URL | Config file is overriding env var | Check opencode.json for a conflicting baseUrl |
402 insufficient_credits | Key budget or balance too low | Top up at Dashboard → Billing |