← All integrations
Terminal coding agentOpenAI Chat CompletionsExperimental

Use DeepSeek V4 with OpenCode

Configure OpenCode with a custom OpenAI-compatible DeepSeek-V4.io provider.

DeepSeek-V4.io is an independent API gateway, not the official DeepSeek website. A paid DeepSeek-V4.io key is required.

How the integration works

OpenCode supports custom providers through the AI SDK OpenAI-compatible adapter. The provider block below keeps the API key in an environment variable and makes DeepSeek V4 Flash selectable as a normal OpenCode model.

One site key

Create and manage it on /developer.

OpenAI Chat Completions

The client talks to its native compatible endpoint.

Upstream hidden

Provider credentials and routing stay on the server.

Before you start

  • OpenCode installed
  • A paid DeepSeek-V4.io account with an API key from /developer
  • An opencode.json configuration file in the project or ~/.config/opencode

Configure OpenCode

1.Configure opencode.json
{
  "$schema": "https://opencode.ai/config.json",
  "model": "deepseek_v4_io/deepseek-v4-flash",
  "providers": {
    "deepseek_v4_io": {
      "name": "DeepSeek-V4.io",
      "env": ["DEEPSEEK_V4_API_KEY"],
      "package": "@opencode-ai/ai/providers/openai-compatible",
      "settings": {
        "baseURL": "https://deepseek-v4.io/api/v1"
      },
      "models": {
        "deepseek-v4-flash": {
          "name": "DeepSeek V4 Flash",
          "capabilities": {
            "tools": true,
            "input": ["text"],
            "output": ["text"]
          },
          "limit": {
            "context": 1048576,
            "output": 65536
          }
        }
      }
    }
  }
}
2.Set the key and start OpenCode
export DEEPSEEK_V4_API_KEY="your-deepseek-v4-io-key"
opencode

Verify the setup

The page remains Experimental until these checks pass against the public DeepSeek-V4.io gateway.

  1. 1Confirm DeepSeek V4 Flash appears as the active model.
  2. 2Run a read-only repository question that requires a tool call.
  3. 3Confirm streamed output and the final tool result both complete.

Troubleshooting

Provider does not appear

Use the current V2 providers object, validate opencode.json, and keep providers, models, and model at the documented nesting levels.

Environment variable is empty

Export DEEPSEEK_V4_API_KEY before launching OpenCode from the same terminal.

Model not found

Use deepseek_v4_io/deepseek-v4-flash in OpenCode and deepseek-v4-flash as the provider model id.

Sources and support boundary

Configuration fields are checked against the tool publisher's documentation. DeepSeek-V4.io owns this gateway guide and support for its endpoint; it does not represent the tool publisher.

OpenCode provider documentation

Ready to connect OpenCode?

Create a DeepSeek-V4.io API key, copy the configuration above, and verify one read-only tool call before using it on a real project.

Open Developer Dashboard