Skip to content

[BUG] Anthropic: thinking.type.enabled not supported, should use adaptive format for new models #782

Description

@ebeigarts

Basic checks

  • I searched existing issues - this hasn't been reported
  • I can reproduce this consistently
  • This is a RubyLLM bug, not my application code

What's broken?

When using RubyLLM with newer Anthropic models (e.g. Opus 4.7), requests fail with the error:

Accumulating error chunk: {"type":"error","error":{"type":"invalid_request_error","message":""thinking.type.enabled" is not supported for this model. Use "thinking.type.adaptive" and "output_config.effort" to control thinking behavior."},"request_id":"..."}

The code currently always sets thinking: {type: "enabled"} in the payload (see lib/ruby_llm/providers/anthropic/chat.rb).

https://platform.claude.com/docs/en/build-with-claude/adaptive-thinking

How to reproduce

  1. Configure RubyLLM to use a newer Anthropic Claude model (e.g. Opus 4.7)
  2. Call chat.with_thinking(...)
  3. Request fails with the error above

Expected behavior

RubyLLM should send thinking: {type: "adaptive"} with output_config.effort, as required by new Anthropic models. It should detect/model-switch as needed to remain compatible with all supported Claude versions.

What actually happened

RubyLLM sends the legacy format and Anthropic rejects the call. Error: "'thinking.type.enabled' is not supported for this model. Use 'thinking.type.adaptive' and 'output_config.effort' to control thinking behavior."

Environment

  • Provider: Anthropic

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions