Skip to content

Opencode

Opencode exposes two OpenAI-compatible AI gateways that share a single DeepIntShield implementation, differing only in default base URL and provider key:

Provider KeyGatewayDefault Base URLBilling
opencode-zenOpencode Zenhttps://opencode.ai/zenPay-as-you-go
opencode-goOpencode Gohttps://opencode.ai/zen/goSubscription

Key features:

  • Full OpenAI compatibility - Identical request/response format
  • Streaming support - Server-Sent Events with delta-based updates
  • Tool calling - Complete function definition and execution support
  • Opencode-aware errors - Parses Opencode’s {"type":"error","error":{...}} envelope
OperationNon-StreamingStreamingEndpoint
Chat Completions/v1/chat/completions
Responses API/v1/chat/completions
List Models-/v1/models
Text Completions-
Embeddings-
Image Generation-
Speech (TTS)-
Transcriptions (STT)-
Files-
Batch-

Add Opencode as a provider with a single API key. Choose the provider key for the gateway you subscribe to:

{
"provider": "opencode-zen",
"keys": [{ "value": "env.OPENCODE_API_KEY", "models": [], "weight": 1.0 }]
}

For the subscription gateway use "provider": "opencode-go". Both default base URLs can be overridden per workspace.


Opencode supports the standard OpenAI chat completion parameters. For full parameter reference and behavior, see OpenAI Chat Completions.


The Responses API is converted internally to Chat Completions and the chat response is mapped back to the Responses shape.


Opencode’s model listing endpoint returns available models at /v1/models.


Opencode returns errors in a custom envelope rather than the OpenAI shape:

{ "type": "error", "error": { "type": "...", "message": "..." } }

DeepIntShield parses this envelope so the surfaced error message and type reflect Opencode’s response while preserving the HTTP status code.