Skip to content

Expected thinking or redacted_thinking, but found tool_use #3077

Description

@jessevdp

Related: #2599

AI_APICallError: litellm.BadRequestError: BedrockException
The model returned the following errors: messages.3.content.0.type: Expected thinking or redacted_thinking, but found tool_use. When thinking is enabled, a final assistant message must start with a thinking block (preceeding the lastmost set of tool_use and tool_result blocks). We recommend you include thinking blocks from previous turns. To avoid this requirement, disable thinking. Please consult our documentation at https://docs.claude.com/en/docs/build-with-claude/extended-thinking

A session share link where this error happened: https://opencode.ai/s/iDe3unHA

My config

{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "my-litellm-provider": {
      "name": "My LiteLLM Provider",
      "npm": "@ai-sdk/openai-compatible",
      "options": {
        "baseURL": "https://my-provider.com",
        "apiKey": "...",
        "includeUsage": true
      },
      "models": {
        "claude-4-5-sonnet": {
          "name": "Anthropic Claude Sonnet 4.5",
          "release_date": "2025-09-29",
          "attachment": true,
          "reasoning": true,
          "temperature": true,
          "tool_call": true,
          "limit": {
            "context": 200000,
            "output": 64000
          },
          "options": {
            "thinking": {
              "type": "enabled",
              "budget_tokens": 16000,
            },
          }
        },
      }
    }
  }
}

Activity

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions