Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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__/lite-llm.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ describe("LiteLLM preserveReasoning model detection", () => {
it("matches case-insensitively", () => {
expect(isLiteLLMPreserveReasoningModel("MiniMax-M2.7-Highspeed")).toBe(true)
expect(isLiteLLMPreserveReasoningModel("GLM-5.2")).toBe(true)
expect(isLiteLLMPreserveReasoningModel("QWEN3.8-MAX")).toBe(true)
})

it("does not match model ids that merely contain a known family as a substring", () => {
Expand Down
17 changes: 17 additions & 0 deletions packages/types/src/__tests__/opencode-go.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {

describe("opencode-go registry", () => {
const anthropicFormatModels = [
"qwen3.8-max",
"qwen3.7-max",
"qwen3.7-plus",
"qwen3.6-plus",
Expand Down Expand Up @@ -78,6 +79,22 @@ describe("opencode-go registry", () => {
expect(info?.outputPrice).toBe(15.0)
expect(info?.cacheReadsPrice).toBe(0.3)
})

it("exposes current Qwen3.8 Max capabilities and Go pricing", () => {
const info = getOpencodeGoModelInfo("qwen3.8-max")
expect(info).toMatchObject({
maxTokens: 131_072,
contextWindow: 1_000_000,
supportsImages: true,
supportsPromptCache: true,
supportsMaxTokens: true,
inputPrice: 2.0,
outputPrice: 6.0,
cacheReadsPrice: 0.25,
cacheWritesPrice: 2.5,
})
expect(info?.preserveReasoning).toBeUndefined()
})
})

describe("OPENCODE_GO_ANTHROPIC_FORMAT_MODELS", () => {
Expand Down
1 change: 1 addition & 0 deletions packages/types/src/__tests__/provider-settings.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ describe("getApiProtocol", () => {

describe("Opencode Go provider", () => {
it("should return 'anthropic' for opencode-go Anthropic-format models (Qwen/MiniMax)", () => {
expect(getApiProtocol(providerIdentifiers.opencodeGo, "qwen3.8-max")).toBe(ANTHROPIC_API_PROTOCOL)
expect(getApiProtocol(providerIdentifiers.opencodeGo, "qwen3.7-max")).toBe(ANTHROPIC_API_PROTOCOL)
expect(getApiProtocol(providerIdentifiers.opencodeGo, "qwen3.7-plus")).toBe(ANTHROPIC_API_PROTOCOL)
expect(getApiProtocol(providerIdentifiers.opencodeGo, "qwen3.6-plus")).toBe(ANTHROPIC_API_PROTOCOL)
Expand Down
15 changes: 7 additions & 8 deletions packages/types/src/providers/lite-llm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,12 @@ export const litellmDefaultModelInfo: ModelInfo = {
*
* Rather than matching model-family substrings with a regex (which can
* over-match unrelated aliases, e.g. a family fragment appearing inside a
* longer unrelated model id), this is an explicit list of the exact model
* ids that set `preserveReasoning: true` in their native provider config
* (see deepseek.ts, mimo.ts, moonshot.ts, bedrock.ts, fireworks.ts, zai.ts,
* minimax.ts, opencode-go.ts). The same behavior is inferred for a
* LiteLLM-routed alias of the same underlying model. Keep this list in sync
* with those registries. This is still best-effort: unrecognized aliases or
* renamed deployments will not match, and callers should treat it as a
* heuristic, not a source of truth.
* longer unrelated model id), this is an explicit list of models whose
* OpenAI-compatible routes use interleaved `reasoning_content`. Native
* provider metadata informs this list where applicable, but gateway routes
* can have different preservation semantics. This is still best-effort:
* unrecognized aliases or renamed deployments will not match, and callers
* should treat it as a heuristic, not a source of truth.
*/
export const LITELLM_PRESERVE_REASONING_MODEL_IDS = [
// deepseek.ts
Expand Down Expand Up @@ -74,6 +72,7 @@ export const LITELLM_PRESERVE_REASONING_MODEL_IDS = [
"qwen3.6-plus",
"qwen3.7-plus",
"qwen3.7-max",
"qwen3.8-max",
] as const

const LITELLM_PRESERVE_REASONING_MODEL_ID_SET = new Set<string>(LITELLM_PRESERVE_REASONING_MODEL_IDS)
Expand Down
14 changes: 14 additions & 0 deletions packages/types/src/providers/opencode-go.ts
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,19 @@ export const opencodeGoModels: Record<string, ModelInfo> = {
description:
"Qwen3.7 Max - Alibaba's flagship text-only reasoning agent model with a 1M context window, designed for long-horizon agent workflows. Available via the Opencode Go plan.",
},
"qwen3.8-max": {
maxTokens: 131_072,
contextWindow: 1_000_000,
supportsImages: true,
supportsPromptCache: true,
supportsMaxTokens: true,
inputPrice: 2.0,
outputPrice: 6.0,
cacheReadsPrice: 0.25,
cacheWritesPrice: 2.5,
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.",
},

// --- DeepSeek ---
"deepseek-v4-pro": {
Expand Down Expand Up @@ -349,6 +362,7 @@ export const opencodeGoModels: Record<string, ModelInfo> = {
*/
export const OPENCODE_GO_ANTHROPIC_FORMAT_MODELS = new Set<string>([
// --- Alibaba Qwen ---
"qwen3.8-max",
"qwen3.7-max",
"qwen3.7-plus",
"qwen3.6-plus",
Expand Down
6 changes: 3 additions & 3 deletions src/api/providers/opencode-go.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ import {
*
* - OpenAI-compatible chat completions (`/v1/chat/completions`, "oa-compat")
* — used by GLM, Kimi, DeepSeek, and MiMo models.
* - Anthropic Messages (`/v1/messages`) — used by Qwen (qwen3.7-max,
* qwen3.7-plus, qwen3.6-plus) and MiniMax (minimax-m3, minimax-m2.7,
* minimax-m2.5) models.
* - Anthropic Messages (`/v1/messages`) — used by Qwen (qwen3.8-max,
* qwen3.7-max, qwen3.7-plus, qwen3.6-plus) and MiniMax (minimax-m3,
* minimax-m2.7, minimax-m2.5) models.
*
* Sending an Anthropic-format model to the chat completions endpoint is
* rejected with `401 Model <id> is not supported for format oa-compat`, so this
Expand Down
Loading