Skip to content

fix(opencode): limit default GPT verbosity - #42075

Closed
Lp-Francois wants to merge 2 commits into
anomalyco:devfrom
Lp-Francois:fix-gpt-verbosity
Closed

fix(opencode): limit default GPT verbosity#42075
Lp-Francois wants to merge 2 commits into
anomalyco:devfrom
Lp-Francois:fix-gpt-verbosity

Conversation

@Lp-Francois

@Lp-Francois Lp-Francois commented Aug 12, 2026

Copy link
Copy Markdown

Context: when using Bedrock with a Gateway such as LiteLLM, we see rejection errors from the Bedrock mantle.

A fix for now is to create a plugin such as:

// In plugins/gateway-compat.ts

import type { Plugin } from "@opencode-ai/plugin"

/**
 * gateway-compat: strip parameters the Contentful AI Gateway (LiteLLM) rejects.
 *
 * OpenCode auto-adds `textVerbosity: "low"` for GPT-5.x models. Via the
 * OpenAI-compatible provider this becomes `verbosity`, which Bedrock Mantle
 * behind the gateway rejects. Remove it for all contentful-gateway GPT-5.x
 * models.
 */
const GatewayCompatibility: Plugin = async () => ({
  "chat.params": async (input, output) => {
    if (input.model.providerID !== "contentful-gateway") return
    if (!input.model.api.id.includes("gpt-5")) return

    delete output.options.textVerbosity
  },
})

export default GatewayCompatibility

But this PR handles it at the root: opencode ✨

Everything is explained in the plugin comment, but TLDR: OpenCode auto-adds textVerbosity: "low" for GPT-5.x models. Bedrock rejects the option for some GTP models.

Note: reviewed by a human (me) and implemented by latest Luna max


Here starts the AI generated part:

Summary

  • only add the GPT-5 textVerbosity default for provider packages known to support it
  • avoid forwarding OpenAI-specific verbosity through generic OpenAI-compatible providers
  • preserve the existing OpenAI and Bedrock Mantle behavior
  • add regression coverage for OpenAI-compatible GPT-5 models

Testing

  • bun test test/provider/transform.test.ts
  • bun typecheck from packages/opencode
  • bun turbo typecheck (pre-push hook)

@github-actions

Copy link
Copy Markdown
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions github-actions Bot added the needs:compliance This means the issue will auto-close after 2 hours. label Aug 12, 2026
@github-actions

Copy link
Copy Markdown
Contributor

This PR doesn't fully meet our contributing guidelines and PR template.

What needs to be fixed:

  • PR description is missing required template sections. Please use the PR template.

Please edit this PR description to address the above within 2 hours, or it will be automatically closed.

If you believe this was flagged incorrectly, please let a maintainer know.

@Lp-Francois

Copy link
Copy Markdown
Author

Let me create the issue now

@github-actions

Copy link
Copy Markdown
Contributor

This pull request has been automatically closed because it was not updated to meet our contributing guidelines within the 2-hour window.

Feel free to open a new pull request that follows our guidelines.

@github-actions github-actions Bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Aug 12, 2026
@github-actions github-actions Bot closed this Aug 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant