These docs track the main branch and may describe unreleased features. The stable documentation lives at docs.docker.com.

OpenCode Go

Use OpenCode Go models with Docker Agent.

Overview

OpenCode Go is a low-cost subscription service ($5 first month, then $10/month) that provides reliable access to popular open-source coding models. It serves models through both OpenAI-compatible and Anthropic-compatible APIs from globally distributed endpoints.

Docker Agent includes built-in support for OpenCode Go as an alias provider.

Setup

  1. Subscribe to OpenCode Go at opencode.ai/auth

  2. Copy your API key from the console

  3. Set the environment variable:

    export OPENCODE_API_KEY=your-api-key
    

Usage

Inline Syntax

The simplest way to use OpenCode Go:

agents:
  root:
    model: opencode-go/deepseek-v4-flash
    description: Assistant using OpenCode Go
    instruction: You are a helpful assistant.

Named Model

For more control over parameters:

models:
  my_model:
    provider: opencode-go
    model: deepseek-v4-pro
    temperature: 0.7
    max_tokens: 8192

agents:
  root:
    model: my_model
    description: Assistant using OpenCode Go
    instruction: You are a helpful assistant.

Available Models

You can retrieve the full, up-to-date model list at any time:

curl https://opencode.ai/zen/go/v1/models

OpenAI-Compatible

These models use the /v1/chat/completions endpoint and work directly with the opencode-go alias:

Model Description
deepseek-v4-flash Fast and cost-effective DeepSeek model
deepseek-v4-pro Most capable DeepSeek model
kimi-k2.7-code Kimi K2.7 optimized for code
kimi-k2.6 Kimi K2.6 model
kimi-k2.5 Kimi K2.5 model
glm-5.2 GLM 5.2 flagship model
glm-5.1 GLM 5.1 model
glm-5 GLM 5 model
mimo-v2.5 MiMo V2.5 efficient model
mimo-v2.5-pro MiMo V2.5 Pro model
mimo-v2-pro MiMo V2 Pro model
mimo-v2-omni MiMo V2 Omni model
hy3-preview HY3 preview model

Anthropic-Compatible

These models use the /v1/messages endpoint and require a custom provider definition:

Model Description
minimax-m3 MiniMax M3 model
minimax-m2.7 MiniMax M2.7 model
minimax-m2.5 MiniMax M2.5 model
qwen3.7-max Qwen 3.7 Max model
qwen3.7-plus Qwen 3.7 Plus model
qwen3.6-plus Qwen 3.6 Plus model
qwen3.5-plus Qwen 3.5 Plus model

To use an Anthropic-compatible model, define a custom provider:

providers:
  opengo-ant:
    provider: anthropic
    base_url: https://opencode.ai/zen/go
    token_key: OPENCODE_API_KEY

models:
  qwen:
    provider: opengo-ant
    model: qwen3.7-max

agents:
  root:
    model: qwen
    description: Assistant using Qwen through OpenCode Go
    instruction: You are a helpful assistant.

How It Works

OpenCode Go is implemented as a built-in alias in Docker Agent:

This means OpenCode Go uses the same client as OpenAI, making it fully compatible with all OpenAI features supported by Docker Agent.

For Anthropic-compatible models (MiniMax, Qwen), Docker Agent uses a custom provider pointing to the Anthropic client at https://opencode.ai/zen/go with the same token.

Session Header

OpenCode asks clients to send an x-opencode-session header carrying one stable ID per conversation, which it uses to optimise routing and prompt caching. Docker Agent sends it on every direct request to opencode.ai, whether the model goes through the built-in alias or a custom provider on the OpenAI, Anthropic or Google client, deriving an opaque value from the agent session so each conversation keeps the same ID, including in serve api / serve chat deployments that multiplex many conversations. Requests routed through a models gateway carry the gateway's own session header instead, and the OpenAI client's opt-in transport: websocket setting is ignored for OpenCode models, which stay on SSE so the header is always sent. On the OpenAI client you can pin your own value through provider_opts.http_headers.x-opencode-session; the Anthropic and Google clients do not read http_headers.

Example: Code Assistant

agents:
  coder:
    model: opencode-go/deepseek-v4-flash
    description: Expert code assistant
    instruction: |
      You are an expert programmer using DeepSeek V4 Flash.
      Write clean, efficient, well-documented code.
      Explain your reasoning when helpful.
    toolsets:
      - type: filesystem
      - type: shell
      - type: think

Usage Limits

OpenCode Go subscriptions include the following limits:

Limits are defined as dollar values. More expensive models allow fewer requests per limit period. You can also add Zen balance to continue usage beyond the limits.