- Anthropic Extended Thinking - Claude’s thinking blocks for complex reasoning
- OpenAI Reasoning via Responses API - GPT’s reasoning effort parameter
Anthropic Extended Thinking
A ready-to-run example is available here!Anthropic’s Claude models support extended thinking, which allows you to access the model’s internal reasoning process through thinking blocks. This is useful for understanding how Claude approaches complex problems step-by-step.
How It Works
The key to accessing thinking blocks is to register a callback that checks forthinking_blocks in LLM messages:
Understanding Thinking Blocks
Claude uses thinking blocks to reason through complex problems step-by-step. There are two types:ThinkingBlock(related anthropic docs): Contains the full reasoning text from Claude’s internal thought processRedactedThinkingBlock(related anthropic docs): Contains redacted or summarized thinking data
Ready-to-run Example Antrophic
This example is available on GitHub: examples/01_standalone_sdk/22_anthropic_thinking.py
examples/01_standalone_sdk/22_anthropic_thinking.py
The model name should follow the LiteLLM convention:
provider/model_name (e.g., anthropic/claude-sonnet-4-5-20250929, openai/gpt-4o).
The LLM_API_KEY should be the API key for your chosen provider.OpenAI Reasoning via Responses API
A ready-to-run example is available here!OpenAI’s latest models (e.g.,
GPT-5, GPT-5-Codex) support a Responses API
that provides access to the model’s reasoning process.
By setting the reasoning_effort parameter, you can control how much reasoning the model performs and access those reasoning traces.
How It Works
Configure the LLM with thereasoning_effort parameter to enable reasoning:
reasoning_effort parameter can be set to "none", "low", "medium", or "high" to control the amount of
reasoning performed by the model.
Then capture reasoning traces in your callback:
Understanding Reasoning Traces
The OpenAI Responses API provides reasoning traces that show how the model approached the problem. These traces are available in the LLM messages and can be inspected to understand the model’s decision-making process. Unlike Anthropic’s thinking blocks, OpenAI’s reasoning is more tightly integrated with the response generation process.Ready-to-run Example OpenAI
This example is available on GitHub: examples/01_standalone_sdk/23_responses_reasoning.py
examples/01_standalone_sdk/23_responses_reasoning.py
The model name should follow the LiteLLM convention:
provider/model_name (e.g., anthropic/claude-sonnet-4-5-20250929, openai/gpt-4o).
The LLM_API_KEY should be the API key for your chosen provider.Use Cases
Debugging: Understand why the agent made specific decisions or took certain actions. Transparency: Show users how the AI arrived at its conclusions. Quality Assurance: Identify flawed reasoning patterns or logic errors. Learning: Study how models approach complex problems.Next Steps
- Interactive Terminal - Display reasoning in real-time
- LLM Metrics - Track token usage and performance
- Custom Tools - Add specialized capabilities

