Skip to content

A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.

OpenCode Go config (#9431)

Chris Fonnesbecka9d3db007bcd
diff --git a/docs/guides/configuration/llm_providers.md b/docs/guides/configuration/llm_providers.md
index 9ccdcbfa07..aa8939c9bd 100644
--- a/docs/guides/configuration/llm_providers.md
+++ b/docs/guides/configuration/llm_providers.md
@@ -73,6 +73,7 @@ You can configure the following providers:
* Mistral
* Ollama
* OpenAI
+* OpenCode Go
* OpenRouter
* Weights & Biases
* Together AI
@@ -303,6 +304,30 @@ base_url = "https://api.inference.wandb.ai/v1/" # Optional, this is the default
See available models at the [Weights & Biases documentation](https://docs.wandb.ai/inference). Make sure to prepend `wandb/` to the model name.
+### OpenCode Go
+
+Access curated open coding models tested and benchmarked for coding agents through the OpenCode Go gateway.
+
+**Requirements**
+
+* Sign in at [opencode.ai/auth](https://opencode.ai/auth), subscribe to Go, and copy your API key
+* `pip install openai` or `uv add openai` (OpenCode Go is OpenAI‑compatible)
+
+**Configuration**
+
+```toml title="marimo.toml"
+[ai.models]
+# Use opencode-go/ prefix for OpenCode Go models. Examples:
+chat_model = "opencode-go/kimi-k2.6"
+edit_model = "opencode-go/qwen3.6-plus"
+
+[ai.opencode_go]
+api_key = "your-opencode-api-key"
+base_url = "https://opencode.ai/zen/go/v1/" # Optional, this is the default
+```
+
+You can also set the `OPENCODE_API_KEY` environment variable instead of `api_key`. See available models at the [OpenCode Go documentation](https://opencode.ai/docs/go/). Make sure to prepend `opencode-go/` to the model slug.
+
### Local models with Ollama { #using-ollama }
Run open-source LLMs locally and connect via an OpenAI‑compatible API.
diff --git a/frontend/src/components/ai/ai-provider-icon.tsx b/frontend/src/components/ai/ai-provider-icon.tsx
index 62a6fb5562..00ec3a257b 100644
--- a/frontend/src/components/ai/ai-provider-icon.tsx
+++ b/frontend/src/components/ai/ai-provider-icon.tsx
@@ -33,6 +33,7 @@ const icons: Record<ProviderId | ExternalAgentId, string> = {
github: GitHubIcon,
openrouter: OpenRouterIcon,
wandb: WandbIcon,
+ "opencode-go": OpencodeIcon,
marimo: marimoIcon,
opencode: OpencodeIcon,
cursor: CursorIcon,
diff --git a/frontend/src/components/ai/ai-utils.ts b/frontend/src/components/ai/ai-utils.ts
index f9e85ea1d1..4f65efea07 100644
--- a/frontend/src/components/ai/ai-utils.ts
+++ b/frontend/src/components/ai/ai-utils.ts
@@ -21,6 +21,7 @@ const CREDENTIAL_CHECKERS: Record<KnownProviderId, CredentialChecker> = {
openrouter: (ai) => Boolean(ai?.openrouter?.api_key),
azure: (ai) => Boolean(ai?.azure?.api_key && ai?.azure?.base_url),
wandb: (ai) => Boolean(ai?.wandb?.api_key),
+ "opencode-go": (ai) => Boolean(ai?.opencode_go?.api_key),
bedrock: (ai) => Boolean(ai?.bedrock?.region_name),
ollama: (ai) => Boolean(ai?.ollama?.base_url),
// These providers don't have user-configurable credentials in the UI
diff --git a/frontend/src/components/app-config/ai-config.tsx b/frontend/src/components/app-config/ai-config.tsx
index abd90217a5..6f20c08693 100644
--- a/frontend/src/components/app-config/ai-config.tsx
+++ b/frontend/src/components/app-config/ai-config.tsx
@@ -1058,6 +1058,36 @@ export const AiProvidersConfig: React.FC<AiConfigProps> = ({
/>
</AccordionFormItem>
+ <AccordionFormItem
+ title="OpenCode Go"
+ provider="opencode-go"
+ isConfigured={hasValue("ai.opencode_go.api_key")}
+ >
+ <ApiKey
+ form={form}
+ config={config}
+ name="ai.opencode_go.api_key"
+ placeholder="your-opencode-api-key"
+ testId="ai-opencode-go-api-key-input"
+ description={
+ <>
+ Your OpenCode API key from{" "}
+ <ExternalLink href="https://opencode.ai/auth">
+ opencode.ai
+ </ExternalLink>
+ . OpenCode Go is a low-cost subscription for open coding models.
+ </>
+ }
+ />
+ <BaseUrl
+ form={form}
+ config={config}
+ name="ai.opencode_go.base_url"
+ placeholder="https://opencode.ai/zen/go/v1/"
+ testId="ai-opencode-go-base-url-input"
+ />
+ </AccordionFormItem>
+
<AccordionFormItem
title="Azure"
provider="azure"
diff --git a/frontend/src/components/ui/links.tsx b/frontend/src/components/ui/links.tsx
index bdc6d0a915..b853b41571 100644
--- a/frontend/src/components/ui/links.tsx
+++ b/frontend/src/components/ui/links.tsx
@@ -15,7 +15,8 @@ export const ExternalLink = ({
| `https://marimo.io/${string}`
| `https://links.marimo.app/${string}`
| `https://wandb.ai/${string}`
- | `https://portal.azure.com/${string}`;
+ | `https://portal.azure.com/${string}`
+ | `https://opencode.ai/${string}`;
children: React.ReactNode;
}) => {
return (
diff --git a/frontend/src/core/ai/ids/ids.ts b/frontend/src/core/ai/ids/ids.ts
index 16617dc88b..82b67f7db6 100644
--- a/frontend/src/core/ai/ids/ids.ts
+++ b/frontend/src/core/ai/ids/ids.ts
@@ -13,6 +13,7 @@ export const KNOWN_PROVIDERS = [
"github",
"openrouter",
"wandb",
+ "opencode-go",
"marimo",
] as const;
export type KnownProviderId = (typeof KNOWN_PROVIDERS)[number];
diff --git a/frontend/src/core/config/config-schema.ts b/frontend/src/core/config/config-schema.ts
index 595be39646..4753caab62 100644
--- a/frontend/src/core/config/config-schema.ts
+++ b/frontend/src/core/config/config-schema.ts
@@ -166,6 +166,7 @@ export const UserConfigSchema = z
ollama: AiConfigSchema.optional(),
openrouter: AiConfigSchema.optional(),
wandb: AiConfigSchema.optional(),
+ opencode_go: AiConfigSchema.optional(),
open_ai_compatible: AiConfigSchema.optional(),
azure: AiConfigSchema.optional(),
bedrock: z
diff --git a/marimo/_config/config.py b/marimo/_config/config.py
index 81604c2621..f71d1f264c 100644
--- a/marimo/_config/config.py
+++ b/marimo/_config/config.py
@@ -309,6 +309,7 @@ class AiConfig(TypedDict, total=False):
- `github`: the GitHub config
- `openrouter`: the OpenRouter config
- `wandb`: the Weights & Biases config
+ - `opencode_go`: the OpenCode Go config
- `custom_providers`: a dict of custom OpenAI-compatible providers
- `open_ai_compatible`: the OpenAI-compatible config (deprecated, use custom_providers)
"""
@@ -329,6 +330,7 @@ class AiConfig(TypedDict, total=False):
github: GitHubConfig
openrouter: OpenAiConfig
wandb: OpenAiConfig
+ opencode_go: OpenAiConfig
custom_providers: NotRequired[dict[str, OpenAiConfig]]
# @deprecated: use `custom_providers` instead
open_ai_compatible: OpenAiConfig
diff --git a/marimo/_server/ai/config.py b/marimo/_server/ai/config.py
index 843950f187..9c45f5fc3c 100644
--- a/marimo/_server/ai/config.py
+++ b/marimo/_server/ai/config.py
@@ -162,6 +162,19 @@ class AnyProviderConfig:
require_key=True,
)
+ @classmethod
+ def for_opencode_go(cls, config: AiConfig) -> AnyProviderConfig:
+ fallback_key = cls.os_key("OPENCODE_API_KEY")
+ return cls._for_openai_like(
+ config,
+ "opencode_go",
+ "OpenCode Go",
+ fallback_key=fallback_key,
+ # Default base URL for OpenCode Go
+ fallback_base_url="https://opencode.ai/zen/go/v1/",
+ require_key=True,
+ )
+
@classmethod
def _for_openai_like(
cls,
@@ -263,6 +276,8 @@ class AnyProviderConfig:
return cls.for_openrouter(config)
elif model_id.provider == "wandb":
return cls.for_wandb(config)
+ elif model_id.provider == "opencode-go":
+ return cls.for_opencode_go(config)
elif model_id.provider == "openai_compatible":
return cls.for_openai_compatible(config)
else:
diff --git a/packages/llm-info/data/models.yml b/packages/llm-info/data/models.yml
index b893dc0858..acd462bc99 100644
--- a/packages/llm-info/data/models.yml
+++ b/packages/llm-info/data/models.yml
@@ -372,3 +372,103 @@
providers: [wandb]
roles: [chat, edit]
thinking: true
+
+# OpenCode Go Models
+
+- name: Kimi K2.6 (OpenCode Go)
+ model: kimi-k2.6
+ description: Latest Kimi Mixture-of-Experts model optimized for complex tool use and reasoning
+ providers: [opencode-go]
+ roles: [chat, edit]
+ thinking: true
+
+- name: Kimi K2.5 (OpenCode Go)
+ model: kimi-k2.5
+ description: Mixture-of-Experts model optimized for complex tool use and reasoning
+ providers: [opencode-go]
+ roles: [chat, edit]
+ thinking: true
+
+- name: MiMo V2.5 Pro (OpenCode Go)
+ model: mimo-v2.5-pro
+ description: MiMo V2.5 Pro coding model with enhanced reasoning
+ providers: [opencode-go]
+ roles: [chat, edit]
+ thinking: true
+
+- name: MiMo V2.5 (OpenCode Go)
+ model: mimo-v2.5
+ description: MiMo V2.5 efficient coding model
+ providers: [opencode-go]
+ roles: [chat, edit]
+ thinking: false
+
+- name: MiMo V2 Pro (OpenCode Go)
+ model: mimo-v2-pro
+ description: MiMo V2 Pro model for coding tasks
+ providers: [opencode-go]
+ roles: [chat, edit]
+ thinking: false
+
+- name: MiMo V2 Omni (OpenCode Go)
+ model: mimo-v2-omni
+ description: MiMo V2 Omni multimodal model
+ providers: [opencode-go]
+ roles: [chat, edit]
+ thinking: false
+
+- name: GLM 5.1 (OpenCode Go)
+ model: glm-5.1
+ description: Mixture-of-Experts model with user-controllable thinking/non-thinking modes
+ providers: [opencode-go]
+ roles: [chat, edit]
+ thinking: true
+
+- name: GLM 5 (OpenCode Go)
+ model: glm-5
+ description: Efficient Mixture-of-Experts model for coding tasks
+ providers: [opencode-go]
+ roles: [chat, edit]
+ thinking: false
+
+- name: MiniMax M2.7 (OpenCode Go)
+ model: minimax-m2.7
+ description: MiniMax M2.7 model with advanced reasoning
+ providers: [opencode-go]
+ roles: [chat, edit]
+ thinking: true
+
+- name: MiniMax M2.5 (OpenCode Go)
+ model: minimax-m2.5
+ description: MiniMax M2.5 model with efficient inference
+ providers: [opencode-go]
+ roles: [chat, edit]
+ thinking: false
+
+- name: Qwen 3.6 Plus (OpenCode Go)
+ model: qwen3.6-plus
+ description: Qwen 3.6 Plus for complex reasoning and coding
+ providers: [opencode-go]
+ roles: [chat, edit]
+ thinking: true
+
+- name: Qwen 3.5 Plus (OpenCode Go)
+ model: qwen3.5-plus
+ description: Qwen 3.5 Plus efficient coding model
+ providers: [opencode-go]
+ roles: [chat, edit]
+ thinking: false
+
+- name: DeepSeek V4 Pro (OpenCode Go)
+ model: deepseek-v4-pro
+ description: DeepSeek V4 Pro coding model with strong reasoning
+ providers: [opencode-go]
+ roles: [chat, edit]
+ thinking: true
+
+- name: DeepSeek V4 Flash (OpenCode Go)
+ model: deepseek-v4-flash
+ description: DeepSeek V4 Flash low-latency coding model
+ providers: [opencode-go]
+ roles: [chat, edit]
+ thinking: false
diff --git a/packages/llm-info/data/providers.yml b/packages/llm-info/data/providers.yml
index 040a43a7b7..3d64659e36 100644
--- a/packages/llm-info/data/providers.yml
+++ b/packages/llm-info/data/providers.yml
@@ -77,3 +77,8 @@
id: wandb
description: Weights & Biases' hosted models for ML development and AI inference.
url: https://wandb.ai/
+
+- name: OpenCode Go
+ id: opencode-go
+ description: Low-cost subscription for reliable access to popular open coding models.
+ url: https://opencode.ai/docs/go/
diff --git a/packages/openapi/api.yaml b/packages/openapi/api.yaml
index 6e37b6f33d..e49369e806 100644
--- a/packages/openapi/api.yaml
+++ b/packages/openapi/api.yaml
@@ -104,9 +104,10 @@ components:
\ the Google AI config\n - `bedrock`: the Bedrock config\n - `azure`:\
\ the Azure config\n - `ollama`: the Ollama config\n - `github`: the\
\ GitHub config\n - `openrouter`: the OpenRouter config\n - `wandb`:\
- \ the Weights & Biases config\n - `custom_providers`: a dict of custom\
- \ OpenAI-compatible providers\n - `open_ai_compatible`: the OpenAI-compatible\
- \ config (deprecated, use custom_providers)"
+ \ the Weights & Biases config\n - `opencode_go`: the OpenCode Go config\n\
+ \ - `custom_providers`: a dict of custom OpenAI-compatible providers\n\
+ \ - `open_ai_compatible`: the OpenAI-compatible config (deprecated, use\
+ \ custom_providers)"
properties:
anthropic:
$ref: '#/components/schemas/AnthropicConfig'
@@ -139,6 +140,8 @@ components:
$ref: '#/components/schemas/OpenAiConfig'
open_ai_compatible:
$ref: '#/components/schemas/OpenAiConfig'
+ opencode_go:
+ $ref: '#/components/schemas/OpenAiConfig'
openrouter:
$ref: '#/components/schemas/OpenAiConfig'
rules:
diff --git a/packages/openapi/src/api.ts b/packages/openapi/src/api.ts
index 02a4cee9b6..d1218dd6fc 100644
--- a/packages/openapi/src/api.ts
+++ b/packages/openapi/src/api.ts
@@ -3408,6 +3408,7 @@ export interface components {
* - `github`: the GitHub config
* - `openrouter`: the OpenRouter config
* - `wandb`: the Weights & Biases config
+ * - `opencode_go`: the OpenCode Go config
* - `custom_providers`: a dict of custom OpenAI-compatible providers
* - `open_ai_compatible`: the OpenAI-compatible config (deprecated, use custom_providers)
*/
@@ -3428,6 +3429,7 @@ export interface components {
ollama?: components["schemas"]["OpenAiConfig"];
open_ai?: components["schemas"]["OpenAiConfig"];
open_ai_compatible?: components["schemas"]["OpenAiConfig"];
+ opencode_go?: components["schemas"]["OpenAiConfig"];
openrouter?: components["schemas"]["OpenAiConfig"];
rules?: string;
wandb?: components["schemas"]["OpenAiConfig"];
diff --git a/tests/_server/ai/test_ai_config.py b/tests/_server/ai/test_ai_config.py
index cf21fae79a..e9a3a1b71a 100644
--- a/tests/_server/ai/test_ai_config.py
+++ b/tests/_server/ai/test_ai_config.py
@@ -318,8 +318,32 @@ class TestAnyProviderConfig:
provider_config = AnyProviderConfig.for_wandb(config)
- assert provider_config.api_key == "test-wandb-key"
- assert provider_config.project == "my-project"
+ def test_for_opencode_go(self):
+ """Test OpenCode Go configuration."""
+ config: AiConfig = {
+ "opencode_go": {
+ "api_key": "test-opencode-key",
+ "base_url": "https://opencode.ai/zen/go/v1/",
+ }
+ }
+
+ provider_config = AnyProviderConfig.for_opencode_go(config)
+
+ assert provider_config.api_key == "test-opencode-key"
+ assert provider_config.base_url == "https://opencode.ai/zen/go/v1/"
+
+ def test_for_opencode_go_with_fallback_base_url(self):
+ """Test OpenCode Go configuration uses fallback base URL when not specified."""
+ config: AiConfig = {
+ "opencode_go": {
+ "api_key": "test-opencode-key",
+ }
+ }
+
+ provider_config = AnyProviderConfig.for_opencode_go(config)
+
+ assert provider_config.api_key == "test-opencode-key"
+ assert provider_config.base_url == "https://opencode.ai/zen/go/v1/"
def test_for_openai_with_project(self):
"""Test OpenAI configuration with project field."""
@@ -747,6 +771,34 @@ class TestProviderConfigWithFallback:
exc_info.value.detail
)
+ @patch.dict(os.environ, {"OPENCODE_API_KEY": "env-opencode-token"})
+ def test_for_opencode_go_with_fallback_key(self) -> None:
+ """Test OpenCode Go config uses fallback key when config is missing api_key."""
+ config: AiConfig = {"opencode_go": {}}
+ provider_config = AnyProviderConfig.for_opencode_go(config)
+ assert provider_config.api_key == "env-opencode-token"
+
+ @patch.dict(os.environ, {"OPENCODE_API_KEY": "env-opencode-token"})
+ def test_for_opencode_go_config_key_takes_precedence(self) -> None:
+ """Test OpenCode Go config key takes precedence over environment variable."""
+ config: AiConfig = {
+ "opencode_go": {"api_key": "config-opencode-token"}
+ }
+ provider_config = AnyProviderConfig.for_opencode_go(config)
+ assert provider_config.api_key == "config-opencode-token"
+
+ @patch.dict(os.environ, {}, clear=True)
+ def test_for_opencode_go_no_fallback_available(self) -> None:
+ """Test OpenCode Go config fails when no config key and no env var."""
+ config: AiConfig = {"opencode_go": {}}
+ with pytest.raises(HTTPException) as exc_info:
+ AnyProviderConfig.for_opencode_go(config)
+
+ assert exc_info.value.status_code == HTTPStatus.BAD_REQUEST
+ assert "OpenCode Go API key not configured" in str(
+ exc_info.value.detail
+ )
+
class TestGetKey:
"""Tests for _get_key function."""