Skip to content

Support reasoning configuration for AWS Bedrock provider #3428

Closed

Description

@kv0409

Summary

OpenCode currently supports extended thinking/reasoning for Anthropic Claude models via the thinking format, but AWS Bedrock providers (e.g., amazon-bedrock/anthropic.*) lack equivalent configuration support.

Problem

When using AWS Bedrock-hosted Claude models (like amazon-bedrock/anthropic.claude-3-7-sonnet-20250219-v1:0), there is no way to enable extended thinking/reasoning, even though:

  1. The underlying Claude model supports reasoning
  2. AWS Bedrock API supports the reasoningConfig parameter
  3. OpenCode successfully uses Bedrock for other model capabilities

This creates a capability gap where Bedrock users cannot leverage extended thinking—a feature available to direct Anthropic API users.

Current Implementation

Anthropic direct API models use the thinking format:

// From the config schema (anthropic/claude-*-thinking)
interface ThinkingConfig {
  type: 'enabled'
  budget_tokens: number
}

AWS Bedrock API supports reasoningConfig:

interface BedrockReasoningConfig {
  traceEnabled?: boolean
}

Proposed Solution

Add support for Bedrock reasoning configuration in the OpenCode config schema and model invocation logic:

  1. Config schema - Add reasoning option to Bedrock model definitions:

    {
      "provider": {
        "amazon-bedrock": {
          "models": {
            "anthropic.claude-3-7-sonnet-20250219-v1:0": {
              "reasoning": true
            }
          }
        }
      }
    }
  2. Model invocation - Pass reasoningConfig when creating Bedrock client requests:

    const requestParams = {
      // ... other params
      reasoningConfig: { traceEnabled: true }
    }
  3. Agent config - Allow enabling reasoning per-agent if needed:

    {
      "agent": {
        "build": {
          "model": "amazon-bedrock/anthropic.claude-3-7-sonnet-20250219-v1:0",
          "reasoning": true
        }
      }
    }

Impact

  • Scope: New feature, non-breaking change
  • Files affected:
    • Config schema validation
    • Bedrock provider implementation
    • Model invocation logic
  • Use cases: Users on AWS/using Bedrock can now leverage extended thinking for complex tasks

Related

Questions for Maintainers

  1. Would this be considered "Support for new providers" per the contributing guidelines?
  2. Should reasoning be agent-level configuration or model-level?
  3. Are there other Bedrock-specific configurations that should be exposed?

Activity

  1. github-actions commented on Oct 24, 2025

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    Feel free to ignore if none of these address your specific case.

  2. rekram1-node commented on Oct 24, 2025

    @rekram1-node
    Contributor

    @kv0409 just noticed a bug with bedrock reasoning, it will be fixed in next release.

    To read more about bedrock reasoning see here: https://ai-sdk.dev/providers/ai-sdk-providers/amazon-bedrock

    Here is what it looks like in opencode.json:

    {
      "$schema": "https://opencode.ai/config.json",
      "provider": {
        "amazon-bedrock": {
          "models": {
            "anthropic.claude-3-7-sonnet-20250219-v1:0": {
              "options": {
                "reasoningConfig": { "type": "enabled", "budgetTokens": 1024 }
              }
            }
          }
        }
      }
    }
    
  3. self-assigned this
    on Oct 24, 2025
  4. rekram1-node commented on Oct 24, 2025

    @rekram1-node
    Contributor

    fixed here, not released yet: 5fec5ff

  5. rekram1-node commented on Oct 25, 2025

    @rekram1-node
    Contributor

    Just released so this should work on 0.15.17, if not lmk

  6. JuniorJPDJ commented on Mar 10, 2026

    @JuniorJPDJ

    Looks like the provided config didn't work for me.
    I tried that:

    {
      "$schema": "https://opencode.ai/config.json",
      "plugin": [],
      "permission": {
        "bash": "ask"
      },
      "model": "amazon-bedrock/redacted-anthropic-claude-sonnet-4-6",
      "provider": {
        "amazon-bedrock": {
          "options": {
            "profile": "redacted"
          },
          "models": {
            "redacted-anthropic-claude-sonnet-4-6": {
              "id": "redacted",
              "name": "Claude Sonnet 4.6 (redacted)",
              "reasoning": true,
              "options": {
                "reasoningConfig": { "type": "enabled", "budgetTokens": 2048 }
              }
            },
            "redacted-anthropic-claude-opus-4-6": {
              "id": "redacted",
              "name": "Claude Opus 4.6 (redacted)",
              "options": {
                "reasoningConfig": { "type": "enabled", "budgetTokens": 2048 }
              }
            }
          }
        }
      }
    }
    

    Models work but there are no thinking blocks at all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions