Skip to content
Merged
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
18 changes: 11 additions & 7 deletions packages/opencode/src/provider/transform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,7 @@ function anthropicOpus47OrLater(apiId: string) {
}

function anthropicAdaptiveEfforts(apiId: string): string[] | null {
if (anthropicOpus47OrLater(apiId)) {
if (anthropicOpus47OrLater(apiId) || apiId.includes("fable-5")) {
return ["low", "medium", "high", "xhigh", "max"]
}
if (
Expand All @@ -619,6 +619,10 @@ function anthropicAdaptiveEfforts(apiId: string): string[] | null {
return null
}

function anthropicOmitsThinking(apiId: string) {
return anthropicOpus47OrLater(apiId) || apiId.includes("fable-5")
}

function googleThinkingLevelEfforts(apiId: string) {
const id = apiId.toLowerCase()
if (!id.includes("gemini-3")) return ["low", "high"]
Expand Down Expand Up @@ -671,7 +675,7 @@ export function variants(model: Provider.Model): Record<string, Record<string, a
thinking: { thinking: { type: "adaptive" } },
}
}
const adaptiveOpus = anthropicOpus47OrLater(model.api.id)
const adaptiveThinkingOmitted = anthropicOmitsThinking(model.api.id)
const adaptiveEfforts = anthropicAdaptiveEfforts(model.api.id)
if (
id.includes("deepseek-chat") ||
Expand Down Expand Up @@ -734,10 +738,10 @@ export function variants(model: Provider.Model): Record<string, Record<string, a
{
thinking: {
type: "adaptive",
// Opus 4.7+ flips the API default for `display` to "omitted", which
// Newer adaptive-only models default `display` to "omitted", which
// returns empty thinking blocks. Force "summarized" so summaries
// survive (4.6/Sonnet 4.6 already default to "summarized").
...(adaptiveOpus ? { display: "summarized" } : {}),
...(adaptiveThinkingOmitted ? { display: "summarized" } : {}),
},
effort,
},
Expand Down Expand Up @@ -884,7 +888,7 @@ export function variants(model: Provider.Model): Record<string, Record<string, a
{
thinking: {
type: "adaptive",
...(adaptiveOpus ? { display: "summarized" } : {}),
...(adaptiveThinkingOmitted ? { display: "summarized" } : {}),
},
effort,
},
Expand Down Expand Up @@ -921,7 +925,7 @@ export function variants(model: Provider.Model): Record<string, Record<string, a
reasoningConfig: {
type: "adaptive",
maxReasoningEffort: effort,
...(adaptiveOpus ? { display: "summarized" } : {}),
...(adaptiveThinkingOmitted ? { display: "summarized" } : {}),
},
},
]),
Expand Down Expand Up @@ -1011,7 +1015,7 @@ export function variants(model: Provider.Model): Record<string, Record<string, a
adaptiveEfforts.map((effort) => [
effort,
{
thinking: { type: "adaptive", ...(adaptiveOpus ? { display: "summarized" } : {}) },
thinking: { type: "adaptive", ...(adaptiveThinkingOmitted ? { display: "summarized" } : {}) },
output_config: { effort },
},
]),
Expand Down
6 changes: 6 additions & 0 deletions packages/opencode/test/provider/transform.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3486,6 +3486,12 @@ describe("ProviderTransform.variants", () => {
efforts: ["low", "medium", "high", "xhigh", "max"],
expectedHigh: { thinking: { type: "adaptive", display: "summarized" }, effort: "high" },
},
{
name: "fable 5",
apiIds: ["claude-fable-5"],
efforts: ["low", "medium", "high", "xhigh", "max"],
expectedHigh: { thinking: { type: "adaptive", display: "summarized" }, effort: "high" },
},
]) {
for (const apiId of testCase.apiIds) {
test(`${testCase.name} ${apiId} returns supported reasoning efforts`, () => {
Expand Down
Loading