Guide

How to use DeepSeek in opencode

Run opencode on DeepSeek V4.1 Flash through Nexum Router's OpenAI-compatible API: one provider block in opencode.json, on a flat $5.50/week plan.

By the Dialagram team Updated 2 min read

What this setup does

opencode works with any OpenAI-compatible provider. Nexum Router serves DeepSeek V4.1 Flash, with a 200,000-token context window, on its OpenAI-compatible API alongside the rest of its 20-model lineup, so one provider entry in opencode.json is all opencode needs.

Step 1: Create an account and an API key

Create an account at /router/auth, subscribe for $5.50/week, and create an API key in the dashboard at /router. Nexum Router keys start with dgr_live_.

Step 2: Put the key in an environment variable

Export NEXUM_API_KEY with your dgr_live_ key in the shell that starts opencode. The config below reads it from the environment, so the key never sits in a file you might commit.
export NEXUM_API_KEY="dgr_live_your-key"

Step 3: Add Nexum Router as a provider in opencode.json

Create or update opencode.json in your project directory: a provider that uses the @ai-sdk/openai-compatible package with the router's OpenAI-compatible base URL, /router/v1. The model line makes DeepSeek V4.1 Flash the default.
{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "nexum": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "Nexum Router",
      "options": {
        "baseURL": "https://dialagram.me/router/v1",
        "apiKey": "{env:NEXUM_API_KEY}"
      },
      "models": {
        "deepseek-v4.1-flash": {
          "name": "DeepSeek V4.1 Flash"
        }
      }
    }
  },
  "model": "nexum/deepseek-v4.1-flash"
}

Step 4: Pick the model in opencode

Start opencode and run /models: DeepSeek V4.1 Flash is listed under Nexum Router. To add another model, put its ID from the list below in the models block.
  • Nexum Router — nexum-router
  • DeepSeek V4.1 Flash — deepseek-v4.1-flash
  • Xiaomi Mimo 2.6 — xiaomi-mimo-2.6
  • Xiaomi Mimo 2.5 — xiaomi-mimo-2.5
  • Meta Muse Spark 1.2 — meta-muse-spark-1.2
  • Meta Muse Spark 1.3 — meta-muse-spark-1.3
  • Qwen 3.5 Plus — qwen-3.5-plus
  • Qwen 3.5 Plus Thinking — qwen-3.5-plus-thinking
  • Qwen 3.6 Plus — qwen-3.6-plus
  • Qwen 3.6 Plus Thinking — qwen-3.6-plus-thinking
  • Qwen 3.7 Plus — qwen-3.7-plus
  • Qwen 3.7 Plus Thinking — qwen-3.7-plus-thinking
  • Qwen 3.6 Max Preview — qwen-3.6-max-preview
  • Qwen 3.7 Max — qwen-3.7-max
  • Qwen 3.7 Max Thinking — qwen-3.7-max-thinking
  • Qwen 3.6 Max Preview Thinking — qwen-3.6-max-preview-thinking
  • Qwen 3.8 Max — qwen-3.8-max
  • Qwen 3.8 Max Thinking — qwen-3.8-max-thinking
  • Qwen 3.8 Omni Flash — qwen-3.8-omni-flash
  • Qwen 3.8 Omni Flash Thinking — qwen-3.8-omni-flash-thinking
  • Qwen 3.5 Omni Plus — qwen-3.5-omni-plus

What DeepSeek usage costs

The flat $5.50/week plan includes $5 of DeepSeek V4.1 Flash usage every day, renewed daily: $35 a week at no extra cost. Unused daily usage does not roll over, and you can add DeepSeek credits from the dashboard at /router. The Qwen, Xiaomi Mimo and Meta Muse Spark models on the same key have no daily allowance, no hourly windows and no weekly caps.

Troubleshooting

  • 401 or invalid API key: NEXUM_API_KEY must be set, to your dgr_live_ key, in the shell that starts opencode.
  • A model is missing from /models: its ID must be in the provider's models block in opencode.json.
  • Context too long: the router answers an over-window request with a context-length error so the client can compact; each model's window is listed at /router/v1/models.