anomalyco / anomalyco/opencode

Amazon Bedrock: thinking.type.enabled sent instead of adaptive; thinking params sent to non-Anthropic models

Open
#50,117 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

Bug Report

Description

When using Amazon Bedrock as a provider, opencode sends thinking.type: "enabled" in the API request. However, the Bedrock API requires thinking.type: "adaptive" (along with output_config.effort). The direct Anthropic API and the Bedrock API have different schemas for controlling thinking behavior, and opencode does not adapt the parameters correctly.

Additionally, when switching to models that do not support thinking at all (e.g., OpenAI GPT models, Fable), opencode still sends thinking parameters, causing those requests to fail as well.

Error Message
The model returned the following errors: "thinking.type.enabled" is not supported for this model. Use "thinking.type.adaptive" and "output_config.effort" to control thinking behavior.
Steps to Reproduce
  1. Configure opencode to use an Amazon Bedrock model (e.g., amazon-bedrock/anthropic.claude-sonnet-4-6)
  2. Attempt to use the model — the request fails with the above error
  3. Switch to a non-Anthropic model (e.g., an OpenAI GPT model or Fable) — the request also fails because thinking params are still sent
Expected Behavior
  • When the provider is amazon-bedrock, opencode should use thinking.type: "adaptive" and output_config.effort instead of thinking.type: "enabled"
  • When switching to a model that does not support thinking (e.g., GPT, Fable), thinking parameters should not be sent at all
Actual Behavior

opencode always sends thinking.type: "enabled" regardless of the provider or model, causing failures on:

  • All Amazon Bedrock Anthropic models (wrong thinking format)
  • All non-Anthropic models (thinking not supported at all)
Workaround

Disabling the thinking variant in ~/.config/opencode/opencode.jsonc:

{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "amazon-bedrock": {
      "models": {
        "anthropic.claude-sonnet-4-6": {
          "variants": {
            "thinking": { "disabled": true },
            "extended-thinking": { "disabled": true }
          }
        }
      }
    }
  }
}
Environment
  • Platform: Linux
  • Model in use: amazon-bedrock/anthropic.claude-sonnet-4-6

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Locate the TypeScript code that builds provider requests and selects thinking parameters from the provider and model. Reproduce the Bedrock and non-thinking-model cases, then verify that Bedrock Anthropic requests use the required adaptive fields while unsupported models omit thinking parameters entirely.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, typescript
Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.