Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/types/src/__tests__/opencode-go.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
describe("opencode-go registry", () => {
const anthropicFormatModels = [
"qwen3.8-max",
"qwen3.8-flash",
"qwen3.7-max",
"qwen3.7-plus",
"qwen3.6-plus",
Expand Down
256 changes: 252 additions & 4 deletions packages/types/src/providers/opencode-go.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import type { ModelInfo } from "../model.js"
// Opencode "Go" plan — OpenAI-compatible gateway.
// https://opencode.ai/docs/go/ · base URL: https://opencode.ai/zen/go/v1
//
// The full model list (and metadata) is fetched dynamically from
// `https://opencode.ai/zen/go/v1/models`, so models can be switched on the fly.
// The values below are only a fallback used before the live list resolves.
// Model IDs are fetched dynamically from `https://opencode.ai/zen/go/v1/models`
// so models can be switched on the fly. The endpoint currently omits metadata,
// so Zoo Code supplies limits and capabilities from the registries below.
export const opencodeGoDefaultModelId = "glm-5.2"

export const opencodeGoDefaultModelInfo: ModelInfo = {
Expand All @@ -16,7 +16,7 @@ export const opencodeGoDefaultModelInfo: ModelInfo = {
// Pricing is intentionally omitted: ModelInfoView renders a `0` field as "$0.00 / 1M tokens"
// (implying the service is free), so we leave it unknown — consistent with the dynamically
// fetched models, which also leave price fields absent. See PR #319 review.
description: "Opencode Go plan model. Available models and metadata are resolved dynamically from /v1/models.",
description: "Opencode Go plan model. Model IDs are fetched dynamically; metadata uses Zoo Code's model registry.",
}

export const OPENCODE_GO_DEFAULT_TEMPERATURE = 0
Expand Down Expand Up @@ -101,6 +101,21 @@ export const opencodeGoModels: Record<string, ModelInfo> = {
description:
"GLM-5.3 is Zhipu's flagship coding and agent model with a 1M context window, 128k max output, and always-on reasoning with configurable effort (Low/High/Max). Available via the Opencode Go plan.",
},
"glm-5.3-flash": {
maxTokens: 131_072,
contextWindow: 1_000_000,
supportsImages: true,
supportsPromptCache: true,
supportsMaxTokens: true,
supportsReasoningEffort: ["low", "high", "max"],
reasoningEffort: "max",
preserveReasoning: true,
inputPrice: 0.075,
outputPrice: 0.25,
cacheReadsPrice: 0.015,
description:
"GLM-5.3 Flash is Zhipu's fast multimodal coding and agent model with a 1M context window and configurable reasoning effort. Available via the Opencode Go plan.",
},
"glm-5.2": {
maxTokens: 131_072,
contextWindow: 1_000_000,
Expand Down Expand Up @@ -162,6 +177,36 @@ export const opencodeGoModels: Record<string, ModelInfo> = {
description:
"Kimi K2.6 is Moonshot AI's native multimodal agentic MoE model with a 256k context window, built for long-horizon coding and tool use. Available via the Opencode Go plan.",
},
"kimi-k2.7-code": {
maxTokens: 262_144,
contextWindow: 262_144,
supportsImages: true,
supportsPromptCache: true,
supportsMaxTokens: true,
preserveReasoning: true,
defaultTemperature: 1.0,
inputPrice: 0.95,
outputPrice: 4.0,
cacheReadsPrice: 0.19,
description:
"Kimi K2.7 Code is Moonshot AI's coding model for long-context programming tasks, with multimodal input and a 256k context window. Available via the Opencode Go plan.",
},

// --- Meituan LongCat ---
"longcat-2.0": {
maxTokens: 131_072,
contextWindow: 1_000_000,
supportsImages: false,
supportsPromptCache: true,
supportsMaxTokens: true,
supportsReasoningBinary: true,
preserveReasoning: true,
inputPrice: 0.3,
outputPrice: 1.2,
cacheReadsPrice: 0.006,
description:
"LongCat 2.0 is Meituan's long-context reasoning and coding model with a 1M context window. Available via the Opencode Go plan.",
},

// --- Xiaomi MiMo ---
"mimo-v2.5": {
Expand Down Expand Up @@ -200,6 +245,36 @@ export const opencodeGoModels: Record<string, ModelInfo> = {
description:
"MiMo V2.5 Pro - Xiaomi's flagship reasoning model with 1M context, deep thinking, and tool calling. Available via the Opencode Go plan.",
},
"mimo-v2-pro": {
maxTokens: 128_000,
contextWindow: 1_048_576,
supportsImages: false,
supportsPromptCache: false,
preserveReasoning: true,
inputPrice: 1.0,
outputPrice: 3.0,
cacheReadsPrice: 0.2,
longContextPricing: {
thresholdTokens: 256_000,
inputPriceMultiplier: 2,
outputPriceMultiplier: 2,
cacheReadsPriceMultiplier: 2,
},
description:
"MiMo V2 Pro is Xiaomi's text reasoning and coding model with a 1M context window. Available via the Opencode Go plan.",
},
"mimo-v2-omni": {
maxTokens: 128_000,
contextWindow: 262_144,
supportsImages: true,
supportsPromptCache: false,
preserveReasoning: true,
inputPrice: 0.4,
outputPrice: 2.0,
cacheReadsPrice: 0.08,
description:
"MiMo V2 Omni is Xiaomi's multimodal reasoning model with a 256k context window. Available via the Opencode Go plan.",
},

// --- MiniMax ---
"minimax-m2.5": {
Expand Down Expand Up @@ -254,6 +329,21 @@ export const opencodeGoModels: Record<string, ModelInfo> = {
},

// --- Alibaba Qwen ---
"qwen3.5-plus": {
maxTokens: 65_536,
contextWindow: 262_144,
supportsImages: true,
supportsPromptCache: true,
supportsReasoningBudget: true,
supportsReasoningBinary: true,
preserveReasoning: true,
inputPrice: 0.2,
outputPrice: 1.2,
cacheReadsPrice: 0.02,
cacheWritesPrice: 0.25,
description:
"Qwen3.5 Plus is Alibaba's multimodal reasoning model with a 256k context window. Available via the Opencode Go plan.",
},
"qwen3.6-plus": {
maxTokens: 65_536,
contextWindow: 1_000_000,
Expand Down Expand Up @@ -320,6 +410,22 @@ export const opencodeGoModels: Record<string, ModelInfo> = {
description:
"Qwen3.8 Max - Alibaba's flagship multimodal reasoning model with a 1M context window, 128k max output, and long-horizon coding and agentic capabilities. Available via the Opencode Go plan.",
},
"qwen3.8-flash": {
maxTokens: 131_072,
contextWindow: 1_000_000,
supportsImages: true,
supportsPromptCache: true,
supportsMaxTokens: true,
supportsReasoningBudget: true,
supportsReasoningBinary: true,
preserveReasoning: true,
inputPrice: 0.15,
outputPrice: 0.47,
cacheReadsPrice: 0.016,
cacheWritesPrice: 0.2,
description:
"Qwen3.8 Flash is Alibaba's fast multimodal reasoning model with a 1M context window. Available via the Opencode Go plan.",
},

// --- DeepSeek ---
"deepseek-v4-pro": {
Expand Down Expand Up @@ -358,6 +464,147 @@ export const opencodeGoModels: Record<string, ModelInfo> = {
description:
"DeepSeek-V4-Flash is DeepSeek's fast, cost-efficient V4 model supporting thinking and non-thinking modes. Available via the Opencode Go plan.",
},
"deepseek-v4-flash-vision-exp": {
maxTokens: 384_000,
contextWindow: 1_000_000,
supportsImages: true,
supportsPromptCache: true,
supportsMaxTokens: true,
supportsReasoningEffort: ["disable", "low", "high", "max"],
reasoningEffort: "high",
preserveReasoning: true,
inputPrice: 0.22,
outputPrice: 0.66,
cacheReadsPrice: 0.007,
description:
"DeepSeek V4 Flash Vision Experimental is a fast multimodal reasoning model with a 1M context window. Available via the Opencode Go plan.",
},

// --- Tencent Hunyuan ---
"hy4-preview": {
maxTokens: 64_000,
contextWindow: 1_024_000,
supportsImages: false,
supportsPromptCache: true,
supportsMaxTokens: true,
supportsReasoningEffort: ["disable", "high"],
reasoningEffort: "high",
preserveReasoning: true,
inputPrice: 0.834,
outputPrice: 2.501,
cacheReadsPrice: 0.042,
description:
"Hunyuan 4 Preview is Tencent's long-context reasoning and coding model with a 1M context window. Available via the Opencode Go plan.",
},
hy3: {
maxTokens: 64_000,
contextWindow: 256_000,
supportsImages: false,
supportsPromptCache: true,
supportsMaxTokens: true,
supportsReasoningEffort: ["disable", "low", "high"],
reasoningEffort: "high",
preserveReasoning: true,
inputPrice: 0.0175,
outputPrice: 0.0725,
cacheReadsPrice: 0.004375,
description:
"Hunyuan 3 is Tencent's reasoning and coding model with a 256k context window. Available via the Opencode Go plan.",
},
"hy3-preview": {
// The live endpoint still lists this historical alias; it shares HY3's limits and pricing.
maxTokens: 64_000,
contextWindow: 256_000,
supportsImages: false,
supportsPromptCache: true,
supportsMaxTokens: true,
supportsReasoningEffort: ["disable", "low", "high"],
reasoningEffort: "high",
preserveReasoning: true,
inputPrice: 0.0175,
outputPrice: 0.0725,
cacheReadsPrice: 0.004375,
description:
"Hunyuan 3 Preview is Tencent's preview reasoning and coding model with a 256k context window. Available via the Opencode Go plan.",
},

// --- Responses API models ---
"gpt-5.6-luna": {
maxTokens: 128_000,
contextWindow: 1_050_000,
supportsImages: true,
supportsPromptCache: true,
supportsMaxTokens: true,
supportsReasoningEffort: ["none", "low", "medium", "high", "xhigh", "max"],
reasoningEffort: "medium",
inputPrice: 0.2,
outputPrice: 1.2,
cacheWritesPrice: 0.25,
cacheReadsPrice: 0.02,
longContextPricing: {
thresholdTokens: 272_000,
inputPriceMultiplier: 2,
outputPriceMultiplier: 1.5,
cacheWritesPriceMultiplier: 2,
cacheReadsPriceMultiplier: 2,
},
description:
"GPT-5.6 Luna is OpenAI's fast reasoning model with a 1M context window. Available via the Opencode Go plan.",
},
"grok-4.5": {
maxTokens: 500_000,
contextWindow: 500_000,
supportsImages: true,
supportsPromptCache: true,
supportsMaxTokens: true,
supportsReasoningEffort: ["low", "medium", "high"],
reasoningEffort: "high",
inputPrice: 2.0,
outputPrice: 6.0,
cacheReadsPrice: 0.3,
longContextPricing: {
thresholdTokens: 200_000,
inputPriceMultiplier: 2,
outputPriceMultiplier: 2,
cacheReadsPriceMultiplier: 2,
},
description:
"Grok 4.5 is xAI's multimodal reasoning and agent model with a 500k context window. Available via the Opencode Go plan.",
},
"grok-4.6": {
maxTokens: 500_000,
contextWindow: 500_000,
supportsImages: true,
supportsPromptCache: true,
supportsMaxTokens: true,
supportsReasoningEffort: ["low", "medium", "high", "xhigh"],
reasoningEffort: "high",
inputPrice: 2.0,
outputPrice: 6.0,
cacheReadsPrice: 0.5,
longContextPricing: {
thresholdTokens: 200_000,
inputPriceMultiplier: 2,
outputPriceMultiplier: 2,
cacheReadsPriceMultiplier: 2,
},
description:
"Grok 4.6 is xAI's multimodal reasoning and agent model with a 500k context window. Available via the Opencode Go plan.",
},
"muse-spark-1.2-contributor": {
maxTokens: 131_072,
contextWindow: 1_048_576,
supportsImages: true,
supportsPromptCache: true,
supportsMaxTokens: true,
supportsReasoningEffort: ["minimal", "low", "medium", "high", "xhigh"],
reasoningEffort: "medium",
inputPrice: 0.1,
outputPrice: 0.2,
cacheReadsPrice: 0.002,
description:
"Muse Spark 1.2 Contributor is Meta's multimodal coding model with a 1M context window. Available via the Opencode Go plan.",
},
}

/**
Expand All @@ -379,6 +626,7 @@ export const opencodeGoModels: Record<string, ModelInfo> = {
export const OPENCODE_GO_ANTHROPIC_FORMAT_MODELS = new Set<string>([
// --- Alibaba Qwen ---
"qwen3.8-max",
"qwen3.8-flash",
"qwen3.7-max",
"qwen3.7-plus",
"qwen3.6-plus",
Expand Down
2 changes: 2 additions & 0 deletions src/api/providers/__tests__/opencode-go.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -799,6 +799,7 @@ describe("OpencodeGoHandler", () => {

describe("isOpencodeGoAnthropicFormatModel", () => {
it("classifies Qwen and MiniMax Go models as Anthropic-format", () => {
expect(isOpencodeGoAnthropicFormatModel("qwen3.8-flash")).toBe(true)
expect(isOpencodeGoAnthropicFormatModel("qwen3.7-max")).toBe(true)
expect(isOpencodeGoAnthropicFormatModel("qwen3.7-plus")).toBe(true)
expect(isOpencodeGoAnthropicFormatModel("qwen3.6-plus")).toBe(true)
Expand All @@ -812,6 +813,7 @@ describe("OpencodeGoHandler", () => {
expect(isOpencodeGoAnthropicFormatModel("kimi-k2.6")).toBe(false)
expect(isOpencodeGoAnthropicFormatModel("deepseek-v4-pro")).toBe(false)
expect(isOpencodeGoAnthropicFormatModel("mimo-v2.5")).toBe(false)
expect(isOpencodeGoAnthropicFormatModel("qwen3.5-plus")).toBe(false)
})

it("defaults unknown model IDs to the OpenAI-compatible format", () => {
Expand Down
Loading
Loading