Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
5 changes: 5 additions & 0 deletions .changeset/opus-4-8-adaptive-thinking.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@kilocode/cli": patch
---

Treat Claude Opus 4.8 as an adaptive thinking model, matching Opus 4.7.
4 changes: 3 additions & 1 deletion packages/opencode/src/plugin/github-copilot/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,9 @@ function build(key: string, remote: Item, url: string, prev?: Model): Model {
variants[effort] = {
thinking: {
type: "adaptive",
...(model.api.id.includes("opus-4.7") ? { display: "summarized" } : {}),
...(model.api.id.includes("opus-4.7") || model.api.id.includes("opus-4.8")
? { display: "summarized" }
: {}), // kilocode_change - treat opus-4.8 like opus-4.7
},
effort,
}
Expand Down
12 changes: 8 additions & 4 deletions packages/opencode/src/provider/transform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,8 @@ function openaiReasoningEfforts(apiId: string, releaseDate: string): string[] |
}

function anthropicAdaptiveEfforts(apiId: string): string[] | null {
if (["opus-4-7", "opus-4.7"].some((v) => apiId.includes(v))) {
if (["opus-4-7", "opus-4.7", "opus-4-8", "opus-4.8"].some((v) => apiId.includes(v))) {
// kilocode_change - treat opus-4.8 like opus-4.7
return ["low", "medium", "high", "xhigh", "max"]
}
if (["opus-4-6", "opus-4.6", "sonnet-4-6", "sonnet-4.6"].some((v) => apiId.includes(v))) {
Expand Down Expand Up @@ -780,7 +781,8 @@ export function variants(model: Provider.Model): Record<string, Record<string, a
if (adaptiveEfforts) {
let efforts = [...adaptiveEfforts]
if (model.providerID === "github-copilot") {
if (model.api.id.includes("opus-4.7")) {
if (model.api.id.includes("opus-4.7") || model.api.id.includes("opus-4.8")) {
Comment thread
chrarnoldus marked this conversation as resolved.
Resolved
// kilocode_change - treat opus-4.8 like opus-4.7
efforts = ["medium"]
}
// Efforts currently supported are: low, medium, high
Expand All @@ -792,7 +794,8 @@ export function variants(model: Provider.Model): Record<string, Record<string, a
{
thinking: {
type: "adaptive",
...(model.api.id.includes("opus-4-7") || model.api.id.includes("opus-4.7")
// kilocode_change - treat opus-4.8 like opus-4.7
...(["opus-4-7", "opus-4.7", "opus-4-8", "opus-4.8"].some((v) => model.api.id.includes(v))
? { display: "summarized" }
: {}),
},
Expand Down Expand Up @@ -827,7 +830,8 @@ export function variants(model: Provider.Model): Record<string, Record<string, a
reasoningConfig: {
type: "adaptive",
maxReasoningEffort: effort,
...(model.api.id.includes("opus-4-7") || model.api.id.includes("opus-4.7")
// kilocode_change - treat opus-4.8 like opus-4.7
...(["opus-4-7", "opus-4.7", "opus-4-8", "opus-4.8"].some((v) => model.api.id.includes(v))
? { display: "summarized" }
: {}),
},
Expand Down
44 changes: 44 additions & 0 deletions packages/opencode/test/kilocode/transform-opus-4.7.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,50 @@ describe("ProviderTransform.variants - Claude Opus 4.7", () => {
})
})

test("opus-4-8 returns adaptive thinking variants including xhigh (native anthropic)", () => {
const model = mockModel({
api: {
id: "claude-opus-4-8",
url: "https://api.anthropic.com",
npm: "@ai-sdk/anthropic",
},
})
const result = ProviderTransform.variants(model)
expect(Object.keys(result)).toEqual(["low", "medium", "high", "xhigh", "max"])
expect(result.xhigh).toEqual({
thinking: { type: "adaptive", display: "summarized" },
effort: "xhigh",
})
})

test("opus-4.8 dot-form returns adaptive thinking variants via @ai-sdk/gateway", () => {
const model = mockModel({
id: "anthropic/claude-opus-4-8",
api: {
id: "anthropic/claude-opus-4.8",
url: "https://gateway.ai",
npm: "@ai-sdk/gateway",
},
})
const result = ProviderTransform.variants(model)
expect(Object.keys(result)).toEqual(["low", "medium", "high", "xhigh", "max"])
})

test("opus-4-8 on bedrock returns adaptive reasoningConfig with xhigh", () => {
const model = mockModel({
api: {
id: "anthropic.claude-opus-4-8",
url: "https://bedrock.amazonaws.com",
npm: "@ai-sdk/amazon-bedrock",
},
})
const result = ProviderTransform.variants(model)
expect(Object.keys(result)).toEqual(["low", "medium", "high", "xhigh", "max"])
expect(result.xhigh).toEqual({
reasoningConfig: { type: "adaptive", maxReasoningEffort: "xhigh", display: "summarized" },
})
})

test("opus-4-6 keeps original adaptive efforts without xhigh", () => {
const model = mockModel({
api: {
Expand Down
Loading