Skip to main content
View your agent’s internal reasoning process for debugging, transparency, and understanding decision-making. This guide demonstrates two provider-specific approaches:
  1. Anthropic Extended Thinking - Claude’s thinking blocks for complex reasoning
  2. OpenAI Reasoning via Responses API - GPT’s reasoning effort parameter

Configure New Or Proxied Models

Use reasoning_effort as the provider-neutral reasoning control. Common values include "none", "minimal", "low", "medium", "high", "xhigh", and "max". Supported values depend on the model and provider. The SDK passes the value to LiteLLM, which translates it to the provider’s request format. By default, the SDK resolves reasoning, sampling, prompt caching, and endpoint support from LiteLLM model metadata. For a gateway alias, provide the underlying model name so capability discovery does not depend on the alias:
Adaptive-thinking models use reasoning_effort; the SDK does not send a legacy manual thinking block for them. extended_thinking_budget remains available only for models confirmed to use manual extended thinking. If a custom gateway cannot expose model metadata, override only the missing capabilities:
api_mode accepts "auto" (the default), "chat", or "responses". Explicit capability overrides take precedence over gateway metadata, local LiteLLM metadata, and SDK fallbacks.

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 for thinking_blocks in LLM messages:

Understanding Thinking Blocks

Claude uses thinking blocks to reason through complex problems step-by-step. There are two types: By registering a callback with your conversation, you can intercept and display these thinking blocks in real-time, giving you insight into how Claude is approaching the problem.

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
You can run the example code as-is.
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.
ChatGPT Plus/Pro subscribers: You can use LLM.subscription_login() to authenticate with your ChatGPT account and access Codex models without consuming API credits. See the LLM Subscriptions guide for details.

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 the reasoning_effort parameter to enable reasoning:
The values supported by reasoning_effort depend on the selected model. For example, many models accept "low", "medium", or "high", while newer models may also accept values such as "minimal", "xhigh", or "max". 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
You can run the example code as-is.
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.
ChatGPT Plus/Pro subscribers: You can use LLM.subscription_login() to authenticate with your ChatGPT account and access Codex models without consuming API credits. See the LLM Subscriptions guide for details.

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