Skip to content

SAP AI Core reasoning variants silently dropped before reaching the wire #30481

@jerome-benoit

Description

@jerome-benoit

Description

opencode emits SAP AI Core reasoning variants at the top level of providerOptions['sap-ai-core']:

  • GPT family: { reasoningEffort: "high" }
  • Claude (Bedrock-routed): { thinking: { type: "adaptive" }, effort } adaptive, or { thinking: { type: "enabled", budgetTokens } } non-adaptive
  • Gemini (Vertex-routed): { thinkingConfig: { includeThoughts, thinkingBudget } }

The @jerome-benoit/sap-ai-provider-v2 Zod schema only declares {api, escapeTemplatePlaceholders, includeReasoning, modelParams, orchestrationConfigRef, placeholderValues, promptTemplateRef} at top level. Unknown keys are silently stripped, so none of these reasoning controls ever reach the SAP SDKs or the upstream backends.

Fix

modelParams has .catchall(z.unknown()) and is forwarded verbatim by both SAP SDKs into request.model.params (orchestration API) or top-level body fields (foundation-models API). Reasoning controls must live under modelParams, using each backend's native REST field names: reasoning_effort for Azure OpenAI, thinking + output_config for Bedrock-routed Claude, thinkingConfig for Vertex-routed Gemini.

Steps to reproduce

git checkout dev
bun install
bun test packages/opencode/test/provider/transform.test.ts

The existing SAP tests assert the dropped shape but never the wire body, so they pass while runtime behavior is broken.

OpenCode version

dev @ dc216e8b0

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions