fix(ai): handle OpenCode Kimi reasoning params
This commit is contained in:
@@ -905,6 +905,12 @@ async function loadModelsDevData(): Promise<Model<any>[]> {
|
||||
compat = { ...(compat ?? {}), supportsReasoningEffort: false };
|
||||
}
|
||||
|
||||
if ((variant.provider === "opencode" || variant.provider === "opencode-go") && modelId === "kimi-k2.6") {
|
||||
// OpenCode Kimi K2.6 accepts Anthropic-style thinking objects
|
||||
// and rejects string thinking values or combined reasoning_effort.
|
||||
compat = { ...(compat ?? {}), thinkingFormat: "deepseek", supportsReasoningEffort: false };
|
||||
}
|
||||
|
||||
// Fix known mismatches between models.dev npm data and actual
|
||||
// OpenCode Go endpoint behaviour. models.dev reports these models
|
||||
// as @ai-sdk/anthropic, but the OpenCode Go endpoints either don't
|
||||
@@ -917,11 +923,6 @@ async function loadModelsDevData(): Promise<Model<any>[]> {
|
||||
api = "openai-completions";
|
||||
baseUrl = `${variant.basePath}/v1`;
|
||||
}
|
||||
if (modelId === "kimi-k2.6") {
|
||||
// OpenCode Go Kimi K2.6 accepts Anthropic-style thinking objects
|
||||
// and rejects string thinking values or combined reasoning_effort.
|
||||
compat = { ...(compat ?? {}), thinkingFormat: "deepseek", supportsReasoningEffort: false };
|
||||
}
|
||||
if (modelId === "qwen3.5-plus" || modelId === "qwen3.6-plus") {
|
||||
api = "openai-completions";
|
||||
baseUrl = `${variant.basePath}/v1`;
|
||||
|
||||
@@ -3868,8 +3868,8 @@ export const MODELS = {
|
||||
cacheRead: 0,
|
||||
cacheWrite: 0,
|
||||
},
|
||||
contextWindow: 144000,
|
||||
maxTokens: 32000,
|
||||
contextWindow: 200000,
|
||||
maxTokens: 64000,
|
||||
} satisfies Model<"anthropic-messages">,
|
||||
"claude-opus-4.5": {
|
||||
id: "claude-opus-4.5",
|
||||
@@ -3886,7 +3886,7 @@ export const MODELS = {
|
||||
cacheRead: 0,
|
||||
cacheWrite: 0,
|
||||
},
|
||||
contextWindow: 160000,
|
||||
contextWindow: 200000,
|
||||
maxTokens: 32000,
|
||||
} satisfies Model<"anthropic-messages">,
|
||||
"claude-opus-4.6": {
|
||||
@@ -3907,7 +3907,7 @@ export const MODELS = {
|
||||
cacheWrite: 0,
|
||||
},
|
||||
contextWindow: 1000000,
|
||||
maxTokens: 64000,
|
||||
maxTokens: 32000,
|
||||
} satisfies Model<"anthropic-messages">,
|
||||
"claude-opus-4.7": {
|
||||
id: "claude-opus-4.7",
|
||||
@@ -3926,7 +3926,27 @@ export const MODELS = {
|
||||
cacheRead: 0,
|
||||
cacheWrite: 0,
|
||||
},
|
||||
contextWindow: 144000,
|
||||
contextWindow: 200000,
|
||||
maxTokens: 32000,
|
||||
} satisfies Model<"anthropic-messages">,
|
||||
"claude-opus-4.8": {
|
||||
id: "claude-opus-4.8",
|
||||
name: "Claude Opus 4.8",
|
||||
api: "anthropic-messages",
|
||||
provider: "github-copilot",
|
||||
baseUrl: "https://api.individual.githubcopilot.com",
|
||||
headers: {"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},
|
||||
compat: {"forceAdaptiveThinking":true},
|
||||
reasoning: true,
|
||||
thinkingLevelMap: {"xhigh":"xhigh"},
|
||||
input: ["text", "image"],
|
||||
cost: {
|
||||
input: 0,
|
||||
output: 0,
|
||||
cacheRead: 0,
|
||||
cacheWrite: 0,
|
||||
},
|
||||
contextWindow: 200000,
|
||||
maxTokens: 64000,
|
||||
} satisfies Model<"anthropic-messages">,
|
||||
"claude-sonnet-4.5": {
|
||||
@@ -3945,7 +3965,7 @@ export const MODELS = {
|
||||
cacheRead: 0,
|
||||
cacheWrite: 0,
|
||||
},
|
||||
contextWindow: 144000,
|
||||
contextWindow: 200000,
|
||||
maxTokens: 32000,
|
||||
} satisfies Model<"anthropic-messages">,
|
||||
"claude-sonnet-4.6": {
|
||||
@@ -4021,7 +4041,7 @@ export const MODELS = {
|
||||
cacheRead: 0,
|
||||
cacheWrite: 0,
|
||||
},
|
||||
contextWindow: 128000,
|
||||
contextWindow: 200000,
|
||||
maxTokens: 64000,
|
||||
} satisfies Model<"openai-completions">,
|
||||
"gemini-3.5-flash": {
|
||||
@@ -4040,7 +4060,7 @@ export const MODELS = {
|
||||
cacheRead: 0,
|
||||
cacheWrite: 0,
|
||||
},
|
||||
contextWindow: 128000,
|
||||
contextWindow: 200000,
|
||||
maxTokens: 64000,
|
||||
} satisfies Model<"openai-completions">,
|
||||
"gpt-4.1": {
|
||||
@@ -4116,8 +4136,8 @@ export const MODELS = {
|
||||
cacheRead: 0,
|
||||
cacheWrite: 0,
|
||||
},
|
||||
contextWindow: 264000,
|
||||
maxTokens: 64000,
|
||||
contextWindow: 400000,
|
||||
maxTokens: 128000,
|
||||
} satisfies Model<"openai-responses">,
|
||||
"gpt-5.2-codex": {
|
||||
id: "gpt-5.2-codex",
|
||||
@@ -7724,7 +7744,9 @@ export const MODELS = {
|
||||
api: "openai-completions",
|
||||
provider: "opencode",
|
||||
baseUrl: "https://opencode.ai/zen/v1",
|
||||
compat: {"supportsReasoningEffort":false},
|
||||
reasoning: true,
|
||||
thinkingLevelMap: {"off":null,"minimal":null,"low":null,"medium":null},
|
||||
input: ["text", "image"],
|
||||
cost: {
|
||||
input: 1,
|
||||
@@ -7758,6 +7780,7 @@ export const MODELS = {
|
||||
api: "openai-completions",
|
||||
provider: "opencode",
|
||||
baseUrl: "https://opencode.ai/zen/v1",
|
||||
compat: {"thinkingFormat":"deepseek","supportsReasoningEffort":false},
|
||||
reasoning: true,
|
||||
input: ["text", "image"],
|
||||
cost: {
|
||||
@@ -7968,9 +7991,9 @@ export const MODELS = {
|
||||
api: "openai-completions",
|
||||
provider: "opencode-go",
|
||||
baseUrl: "https://opencode.ai/zen/go/v1",
|
||||
compat: {"thinkingFormat":"string-thinking"},
|
||||
compat: {"thinkingFormat":"deepseek","supportsReasoningEffort":false},
|
||||
reasoning: true,
|
||||
thinkingLevelMap: {"off":"none"},
|
||||
thinkingLevelMap: {"minimal":null,"low":null,"medium":null},
|
||||
input: ["text", "image"],
|
||||
cost: {
|
||||
input: 0.95,
|
||||
@@ -8049,24 +8072,6 @@ export const MODELS = {
|
||||
contextWindow: 204800,
|
||||
maxTokens: 131072,
|
||||
} satisfies Model<"openai-completions">,
|
||||
"qwen3.5-plus": {
|
||||
id: "qwen3.5-plus",
|
||||
name: "Qwen3.5 Plus",
|
||||
api: "openai-completions",
|
||||
provider: "opencode-go",
|
||||
baseUrl: "https://opencode.ai/zen/go/v1",
|
||||
compat: {"thinkingFormat":"qwen"},
|
||||
reasoning: true,
|
||||
input: ["text", "image"],
|
||||
cost: {
|
||||
input: 0.2,
|
||||
output: 1.2,
|
||||
cacheRead: 0.02,
|
||||
cacheWrite: 0.25,
|
||||
},
|
||||
contextWindow: 262144,
|
||||
maxTokens: 65536,
|
||||
} satisfies Model<"openai-completions">,
|
||||
"qwen3.6-plus": {
|
||||
id: "qwen3.6-plus",
|
||||
name: "Qwen3.6 Plus",
|
||||
@@ -8818,13 +8823,13 @@ export const MODELS = {
|
||||
thinkingLevelMap: {"minimal":null,"low":null,"medium":null,"high":"high","xhigh":"xhigh"},
|
||||
input: ["text"],
|
||||
cost: {
|
||||
input: 0.09999999999999999,
|
||||
output: 0.19999999999999998,
|
||||
cacheRead: 0.02,
|
||||
input: 0.0983,
|
||||
output: 0.1966,
|
||||
cacheRead: 0.019700000000000002,
|
||||
cacheWrite: 0,
|
||||
},
|
||||
contextWindow: 1048576,
|
||||
maxTokens: 16384,
|
||||
maxTokens: 131072,
|
||||
} satisfies Model<"openai-completions">,
|
||||
"deepseek/deepseek-v4-flash:free": {
|
||||
id: "deepseek/deepseek-v4-flash:free",
|
||||
@@ -8895,7 +8900,7 @@ export const MODELS = {
|
||||
cacheRead: 0.024999999999999998,
|
||||
cacheWrite: 0.08333333333333334,
|
||||
},
|
||||
contextWindow: 1000000,
|
||||
contextWindow: 1048576,
|
||||
maxTokens: 8192,
|
||||
} satisfies Model<"openai-completions">,
|
||||
"google/gemini-2.0-flash-lite-001": {
|
||||
@@ -9945,13 +9950,13 @@ export const MODELS = {
|
||||
reasoning: true,
|
||||
input: ["text", "image"],
|
||||
cost: {
|
||||
input: 0.73,
|
||||
output: 3.49,
|
||||
cacheRead: 0.25,
|
||||
input: 0.684,
|
||||
output: 3.42,
|
||||
cacheRead: 0.144,
|
||||
cacheWrite: 0,
|
||||
},
|
||||
contextWindow: 262144,
|
||||
maxTokens: 262142,
|
||||
maxTokens: 262144,
|
||||
} satisfies Model<"openai-completions">,
|
||||
"moonshotai/kimi-k2.6:free": {
|
||||
id: "moonshotai/kimi-k2.6:free",
|
||||
@@ -12090,6 +12095,23 @@ export const MODELS = {
|
||||
contextWindow: 262144,
|
||||
maxTokens: 16384,
|
||||
} satisfies Model<"openai-completions">,
|
||||
"stepfun/step-3.7-flash": {
|
||||
id: "stepfun/step-3.7-flash",
|
||||
name: "StepFun: Step 3.7 Flash",
|
||||
api: "openai-completions",
|
||||
provider: "openrouter",
|
||||
baseUrl: "https://openrouter.ai/api/v1",
|
||||
reasoning: true,
|
||||
input: ["text", "image"],
|
||||
cost: {
|
||||
input: 0.19999999999999998,
|
||||
output: 1.15,
|
||||
cacheRead: 0.04,
|
||||
cacheWrite: 0,
|
||||
},
|
||||
contextWindow: 256000,
|
||||
maxTokens: 256000,
|
||||
} satisfies Model<"openai-completions">,
|
||||
"tencent/hy3-preview": {
|
||||
id: "tencent/hy3-preview",
|
||||
name: "Tencent: Hy3 preview",
|
||||
@@ -12609,13 +12631,13 @@ export const MODELS = {
|
||||
reasoning: true,
|
||||
input: ["text", "image"],
|
||||
cost: {
|
||||
input: 0.73,
|
||||
output: 3.49,
|
||||
cacheRead: 0.25,
|
||||
input: 0.684,
|
||||
output: 3.42,
|
||||
cacheRead: 0.144,
|
||||
cacheWrite: 0,
|
||||
},
|
||||
contextWindow: 262144,
|
||||
maxTokens: 262142,
|
||||
maxTokens: 262144,
|
||||
} satisfies Model<"openai-completions">,
|
||||
"~openai/gpt-latest": {
|
||||
id: "~openai/gpt-latest",
|
||||
@@ -13013,20 +13035,20 @@ export const MODELS = {
|
||||
} satisfies Model<"anthropic-messages">,
|
||||
"alibaba/qwen-3-235b": {
|
||||
id: "alibaba/qwen-3-235b",
|
||||
name: "Qwen3 235B A22b Instruct 2507",
|
||||
name: "Qwen3 235B A22B",
|
||||
api: "anthropic-messages",
|
||||
provider: "vercel-ai-gateway",
|
||||
baseUrl: "https://ai-gateway.vercel.sh",
|
||||
reasoning: false,
|
||||
input: ["text"],
|
||||
cost: {
|
||||
input: 0.6,
|
||||
output: 1.2,
|
||||
cacheRead: 0.6,
|
||||
input: 0.22,
|
||||
output: 0.88,
|
||||
cacheRead: 0,
|
||||
cacheWrite: 0,
|
||||
},
|
||||
contextWindow: 131000,
|
||||
maxTokens: 40000,
|
||||
contextWindow: 262144,
|
||||
maxTokens: 16384,
|
||||
} satisfies Model<"anthropic-messages">,
|
||||
"alibaba/qwen-3-30b": {
|
||||
id: "alibaba/qwen-3-30b",
|
||||
|
||||
Reference in New Issue
Block a user