Skip to content

Commit 53b11d3

Browse files
authored
feat(opencode): configure Cohere North model (anomalyco#31536)
1 parent 8ef6289 commit 53b11d3

2 files changed

Lines changed: 50 additions & 0 deletions

File tree

packages/opencode/src/provider/transform.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -478,6 +478,7 @@ export function message(msgs: ModelMessage[], model: Provider.Model, options: Re
478478

479479
export function temperature(model: Provider.Model) {
480480
const id = model.id.toLowerCase()
481+
if (id.includes("north-mini-code")) return 1.0
481482
if (id.includes("qwen")) return 0.55
482483
if (id.includes("claude")) return undefined
483484
if (id.includes("gemini")) return 1.0
@@ -826,6 +827,9 @@ export function variants(model: Provider.Model): Record<string, Record<string, a
826827
case "venice-ai-sdk-provider":
827828
// https://docs.venice.ai/overview/guides/reasoning-models#reasoning-effort
828829
case "@ai-sdk/openai-compatible":
830+
if (model.api.id.toLowerCase().includes("north-mini-code")) {
831+
return Object.fromEntries(["none", "high"].map((effort) => [effort, { reasoningEffort: effort }]))
832+
}
829833
const efforts = [...WIDELY_SUPPORTED_EFFORTS]
830834
if (model.api.id.toLowerCase().includes("deepseek-v4")) {
831835
efforts.push("max")
@@ -1105,6 +1109,10 @@ export function options(input: {
11051109
}
11061110

11071111
const modelId = input.model.api.id.toLowerCase()
1112+
if (modelId.includes("north-mini-code") && input.model.api.npm === "@ai-sdk/openai-compatible") {
1113+
result["options"] = { citation_options: { mode: "disabled" } }
1114+
}
1115+
11081116
// MiniMax's Anthropic interface defaults thinking off, unlike Chat Completions.
11091117
if (modelId.includes("minimax-m3") && input.model.api.npm === "@ai-sdk/anthropic") {
11101118
result["thinking"] = { type: "adaptive" }

packages/opencode/test/provider/transform.test.ts

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2483,6 +2483,31 @@ describe("ProviderTransform.message - cache control on gateway", () => {
24832483
})
24842484
})
24852485

2486+
describe("ProviderTransform.options - Cohere North", () => {
2487+
test("disables citations by default for north-mini-code-1-0", () => {
2488+
const result = ProviderTransform.options({
2489+
model: {
2490+
id: "cohere/north-mini-code-1-0",
2491+
providerID: "cohere",
2492+
api: {
2493+
id: "North-Mini-Code-1-0-latest",
2494+
url: "https://api.cohere.com/compatibility/v1",
2495+
npm: "@ai-sdk/openai-compatible",
2496+
},
2497+
capabilities: { reasoning: true },
2498+
} as any,
2499+
sessionID: "test-session-123",
2500+
})
2501+
expect(result.options).toEqual({ citation_options: { mode: "disabled" } })
2502+
})
2503+
})
2504+
2505+
describe("ProviderTransform.temperature - Cohere North", () => {
2506+
test("defaults north-mini-code models to 1.0", () => {
2507+
expect(ProviderTransform.temperature({ id: "cohere/North-Mini-Code-1-0-latest" } as any)).toBe(1.0)
2508+
})
2509+
})
2510+
24862511
describe("ProviderTransform.variants", () => {
24872512
const createMockModel = (overrides: Partial<any> = {}): any => ({
24882513
id: "test/test-model",
@@ -3209,6 +3234,23 @@ describe("ProviderTransform.variants", () => {
32093234
expect(result.low).toEqual({ reasoningEffort: "low" })
32103235
expect(result.high).toEqual({ reasoningEffort: "high" })
32113236
})
3237+
3238+
test("north-mini-code-1-0 returns only none and high", () => {
3239+
const model = createMockModel({
3240+
id: "cohere/north-mini-code-1-0",
3241+
providerID: "cohere",
3242+
api: {
3243+
id: "North-Mini-Code-1-0-latest",
3244+
url: "https://api.cohere.com/compatibility/v1",
3245+
npm: "@ai-sdk/openai-compatible",
3246+
},
3247+
})
3248+
const result = ProviderTransform.variants(model)
3249+
expect(result).toEqual({
3250+
none: { reasoningEffort: "none" },
3251+
high: { reasoningEffort: "high" },
3252+
})
3253+
})
32123254
})
32133255

32143256
describe("@ai-sdk/azure", () => {

0 commit comments

Comments
 (0)