Skip to content
Open
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
2 changes: 1 addition & 1 deletion packages/core/src/variant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ const openrouter: Protocol = (model, support) => {

const bedrockConverse: Protocol = (model, support) => {
const id = modelID(model)
const claude = id.includes("anthropic")
const claude = id.includes("anthropic") || model.family === "claude" || model.family?.startsWith("claude-")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With an opaque ARN, claudeInfo(model) can't parse a version. So manual is false, and effort variants always add thinking: ADAPTIVE_THINKING (I checked: the ARN + claude-sonnet case gives thinking: adaptive + output_config). The same model by catalog id (us.anthropic.claude-sonnet-4-5…) gets only output_config: {effort}, because 4.5 and older don't use adaptive thinking. The real-profile check in #53756 used a Sonnet 4.5 profile, so this path may still be rejected for many users. It's an improvement over reasoningConfig, but please consider adding a test for the older-model case and noting the limitation. The catalog-id-as-key config from the issue still covers those models.

const fields = (fields: Record<string, unknown>): Overlay => ({ body: { additionalModelRequestFields: fields } })
switch (support.type) {
case "effort":
Expand Down
35 changes: 35 additions & 0 deletions packages/core/test/variant.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,25 @@ test("spells Chat Completions variants for direct providers", () => {
])
})

test("recognizes Claude family metadata for Bedrock inference profile ARNs", () => {
for (const family of ["claude-sonnet", "claude"]) {
const input = model("@opencode/ai/providers/amazon-bedrock", "arn:aws:bedrock:us-east-1:123456789012:application-inference-profile/opaque") as Model.MutableInfo
input.family = Model.Family.make(family)

expect(resolve(Model.Info.make(input), [{ type: "effort", values: ["high"] }])).toEqual([
{
id: "high",
body: {
additionalModelRequestFields: {
thinking: { type: "adaptive", display: "summarized" },
output_config: { effort: "high" },
},
},
},
])
}
})

test("spells Bedrock Converse Claude budgets as a thinking setting", () => {
expect(
resolve(model("@opencode/ai/providers/amazon-bedrock", "us.anthropic.claude-haiku-4-5-20251001-v1:0", 64_000), [
Expand Down Expand Up @@ -288,6 +307,22 @@ test("spells Bedrock Converse effort for Grok and Nova", () => {
body: { additionalModelRequestFields: { reasoningConfig: { type: "enabled", maxReasoningEffort: "xhigh" } } },
},
])

const inferenceProfile = model(
"@opencode/ai/providers/amazon-bedrock",
"arn:aws:bedrock:us-east-1:123456789012:application-inference-profile/opaque",
) as Model.MutableInfo
inferenceProfile.family = Model.Family.make("nova")
expect(resolve(Model.Info.make(inferenceProfile), supports)).toEqual([
{
id: "low",
body: { additionalModelRequestFields: { reasoningConfig: { type: "enabled", maxReasoningEffort: "low" } } },
},
{
id: "xhigh",
body: { additionalModelRequestFields: { reasoningConfig: { type: "enabled", maxReasoningEffort: "xhigh" } } },
},
])
})

test("caps Alibaba thinking budget variants at 64k", () => {
Expand Down
Loading