BlazeInferDocs
Integrations

OpenCode

Use BlazeInfer models in OpenCode, the open-source terminal coding agent.

SupportedTested with: OpenCode 2.2.5 and 1.19.5 · Last verified: 2026-11-02

OpenCode is an open-source coding agent for the terminal, desktop and web. BlazeInfer plugs in as an OpenAI-compatible provider.

Using the desktop app?

Follow OpenCode desktop. Desktop apps on macOS do not see keys exported in your shell profile, so that page reads the key from a file instead.

Prerequisites

  • A BlazeInfer account with credits and an API key (see Quickstart).
  • BLAZE_API_KEY set in the shell that starts OpenCode.
  • Your OpenCode version. Run opencode --version. OpenCode 1.x and 2.x use different config formats, so pick the matching tab below.

Configure

File: ~/.config/opencode/opencode.json

{
  "$schema": "https://opencode.ai/config.json",
  "model": "blaze/deepseek-ai/deepseek-v4.1-flash",
  "provider": {
    "blaze": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "BlazeInfer",
      "options": {
        "baseURL": "https://blaze.e2enetworks.net/v1",
        "apiKey": "{env:BLAZE_API_KEY}"
      },
      "models": {
        "deepseek-ai/deepseek-v4.1-flash": {
          "name": "DeepSeek V4.1 Flash (BlazeInfer)",
          "tool_call": true,
          "reasoning": true,
          "modalities": { "input": ["text", "image"], "output": ["text"] },
          "limit": { "context": 1048576, "output": 16384 }
        },
        "zai-org/glm-5.3-flash": {
          "name": "GLM 5.3 Flash (BlazeInfer)",
          "tool_call": true,
          "modalities": { "input": ["text"], "output": ["text"] },
          "limit": { "context": 1048576, "output": 16384 }
        }
      }
    }
  }
}

Both versions read either file name, opencode.json or opencode.jsonc. What matters is the format inside the file.

Always set the token limits

Without limit, OpenCode asks for 32,000 output tokens. That is more than some models allow, and the request fails with "The upstream provider rejected the request."

Choose a model

Model IDContextNotes
deepseek-ai/deepseek-v4.1-flash1,048,576The largest context window, for long coding-agent sessions. Reasoning is on by default and comes back in the reasoning field. Accepts images. Use up to 1,048,576 tokens of context.
zai-org/glm-5.3-flash1,048,576A 1,048,576-token context window, for long coding-agent sessions. Supports tool calling. Does not accept images.

See the console for every model, including ones that are not recommended for coding agents.

Verify it works

Start OpenCode in a small Git repository and send a prompt that needs tools, for example "create hello.py that prints hi, then run it". A working setup shows the BlazeInfer model, writes the file and prints hi.

Reasoning effort

DeepSeek V4.1 Flash

OpenCode's Low, Medium and High think about equally hard on DeepSeek V4.1 Flash. Its deeper level is max, about twice as slow as high (see Reasoning effort). In the 2.x format, add the levels as variants of the model:

"deepseek-v4.1-flash": {
  "modelID": "deepseek-ai/deepseek-v4.1-flash",
  // ...capabilities, compatibility and limit as above
  "variants": [
    { "id": "low", "settings": { "reasoningEffort": "low" } },
    { "id": "medium", "settings": { "reasoningEffort": "medium" } },
    { "id": "high", "settings": { "reasoningEffort": "high" } },
    { "id": "max", "settings": { "reasoningEffort": "max" } },
    { "id": "off", "settings": { "reasoningEffort": "none" } }
  ]
}

List all five: once a model has variants, they replace OpenCode's built-in Low, Medium and High instead of adding to them. Then run /reload and pick one:

  • Interactive: /variants, or press Ctrl+T to cycle.
  • One-off: opencode run --model blaze/deepseek-v4.1-flash#max "...".

The desktop app reads the same config, so the variants appear there too. To check that Max works, use the test prompt in OpenCode desktop.

Configuration tips

  • Two config formats. OpenCode 1.x and 2.x use different formats; use the tab that matches your version. Always set limit.context and limit.output. Without them, OpenCode asks for more output tokens than some models allow.
  • Reasoning field. In the 2.x format, set compatibility.reasoningField to the field your model returns (reasoning_content or reasoning). See Reasoning models.
  • Declare each model in the config. OpenCode does not read /v1/models for custom providers.
  • Context size. Models at 32K or below are not recommended for OpenCode.
  • OpenCode 2.x reads the 1.x format but drops the reasoning setting.

Privacy note

OpenCode may send telemetry or update checks to its own services, independent of BlazeInfer. Review its configuration if data locality matters to you.

On this page