Skip to content

fix(provider): guard textVerbosity injection for @ai-sdk/openai-compatible providers - #43915

Merged
neriousy merged 1 commit into
anomalyco:devfrom
joelstucki-taulia:fix/43911-textverbosity-openai-compatible-guard
Aug 21, 2026
Merged

fix(provider): guard textVerbosity injection for @ai-sdk/openai-compatible providers#43915
neriousy merged 1 commit into
anomalyco:devfrom
joelstucki-taulia:fix/43911-textverbosity-openai-compatible-guard

Conversation

@joelstucki-taulia

Copy link
Copy Markdown
Contributor

Issue for this PR

Closes #43911

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

options() in transform.ts sets textVerbosity: "low" for any gpt-5.x model as long as providerID !== "azure". That guard allows the default through for generic @ai-sdk/openai-compatible providers too (e.g. a LiteLLM proxy), which is wrong: verbosity is an OpenAI-specific parameter, and non-OpenAI backends behind such a proxy reject it outright.

Concretely, a gpt-5.6 model routed through a LiteLLM @ai-sdk/openai-compatible provider to AWS Bedrock ("Bedrock Mantle") fails every request with:

litellm.UnsupportedParamsError: bedrock_mantle does not support parameters: ['verbosity'], for model=openai.gpt-5.6-luna...

This is the same bug class already fixed for reasoningSummary in #21237 / #22352 (unconditional injection for gpt-5.x, guarded only against Azure instead of an explicit allowlist). textVerbosity never got the equivalent fix.

The fix switches the check from a denylist (providerID !== "azure") to an allowlist of providers known to actually implement verbosity: @ai-sdk/openai and @ai-sdk/amazon-bedrock/mantle. Everything else (including @ai-sdk/openai-compatible, @ai-sdk/azure, @ai-sdk/github-copilot) no longer receives textVerbosity, matching how reasoningSummary/include are already scoped a few lines above in the same function.

How did you verify your code works?

  • bun test test/provider/transform.test.ts — 411 pass, 0 fail (added an explicit expect(result.textVerbosity).toBeUndefined() assertion to the existing openai-compatible gpt-5 models omit Responses-only reasoningSummary test).
  • bun turbo typecheck — 30/30 packages pass.
  • Reproduced the original error against a LiteLLM proxy fronting Bedrock Mantle; after this change textVerbosity is correctly omitted from the request and the call succeeds.

Screenshots / recordings

N/A — no UI change.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

…tible providers

Only enable the gpt-5.x textVerbosity default for integrations known to
implement OpenAI's verbosity parameter (@ai-sdk/openai and
@ai-sdk/amazon-bedrock/mantle). Previously the guard excluded only
Azure, so generic @ai-sdk/openai-compatible providers (e.g. LiteLLM
proxies) received textVerbosity as well. When such a proxy routes to
AWS Bedrock behind the scenes, Bedrock rejects the resulting verbosity
parameter with litellm.UnsupportedParamsError, breaking every request
(including configured fallbacks) to any gpt-5.x model on that provider.

This mirrors the existing reasoningSummary guard pattern fixed in
anomalyco#21237 / anomalyco#22352, which textVerbosity never received.

Fixes anomalyco#43911
@neriousy

Copy link
Copy Markdown
Contributor

Thanks for the PR!

@neriousy
neriousy merged commit 3a4c253 into anomalyco:dev Aug 21, 2026
10 checks passed
Anonymouse8882 pushed a commit to Anonymouse8882/opencode that referenced this pull request Aug 27, 2026
…tible providers (anomalyco#43915)

Co-authored-by: Joel Stucki <joel.stucki@example.com>
(cherry picked from commit 3a4c253)
Archipel pushed a commit to Archipel/opencode that referenced this pull request Aug 29, 2026
…tible providers (anomalyco#43915)

Co-authored-by: Joel Stucki <joel.stucki@example.com>
1056674754 added a commit to 1056674754/opencode that referenced this pull request Aug 31, 2026
Upstream v1.18.21 (826d9ad, merged at ab828ce) -> v1.18.22 (47b6b6f),
40 commits / 197 files. Upstream superseded the v1.18.21 release commit with
ad0bb6d6 (sync release versions for v1.18.21) in the v1.18.22 lineage; merge
base is 57fa34f (fix anomalyco#43892), effective input identical to the audited
40-commit range.

Functional changes:
- fix(opencode): normalize upgrade endpoint (anomalyco#44686) — target is now a
  required semver field, raw-body upgrade handler dropped; groups/handlers
  global httpapi + generated SDK (sdk.gen description, types.gen required
  target, openapi required:["target"]) adopted whole; fork had no global
  httpapi deltas.
- fix: resolve console device URLs (anomalyco#44029) — origin-rooted
  verification_uri_complete resolved via URL() with HTTP(S) protocol
  validation in account.ts and core plugin/provider/opencode.ts, with
  upstream tests for both.
- fix(provider): guard textVerbosity injection for
  @ai-sdk/openai-compatible providers (anomalyco#43915) — adopted onto fork
  transform.ts; hunks disjoint from GLM/ZhiPu normalization, auto-merged.
- fix: bump Amazon Bedrock provider (anomalyco#43909) — 4.0.112 -> 4.0.158.
- test(opencode): align unknown finish coverage (anomalyco#43895).
- console zen streaming/memory + unblock workspace, stats model
  normalization + tooltip truncation, app model provider headers, go
  pricing changes, docs + i18n updates.

Conflicts resolved: 30 package.json version bumps (rebranded 1.18.22-sscity),
bun.lock (took upstream, rebranded workspace entries via bun install).
run-process.test.ts reconciled by hand: the shared "unknown stream finish
preserves partial output and continues" test keeps the fork streamError +
auto-ok form; upstream's json variant adopted under its upstream name with
the middle-step expectation adapted to the fork's stronger semantics —
output-less errored streams are retried transparently (adjacent step-starts,
no step-finish part), while the with-output unknown-finish path (step-finish
reason "unknown" then loop continues) stays covered by the fork json test.
Fork retry caps (content-policy maxAttempts) and GLM/ZhiPu transform
normalization preserved; fork small_model_fallback generated SDK/OpenAPI
surfaces kept, merge-consistent with upstream's upgrade regen. Tests from
both sides kept: transform 437, retry 68, account 15, httpapi-global 4,
run-process 15, prompt 62, empty-stream 6, core provider-opencode 12,
stats inference 11, llm package 328 all pass; typecheck 30/30.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

textVerbosity injected for gpt-5.x on @ai-sdk/openai-compatible providers, breaks Bedrock Mantle via LiteLLM gateway

2 participants