Using Reasoning Models
Reasoning models are specialized LLMs that excel at complex problem-solving by explicitly showing their thought process. They are particularly effective for tasks requiring multi-step logic, analytical thinking, and code generation. We support several reasoning models that provide both the final answer and the full reasoning trace used to arrive at that answer. See our pricing page for a list of available reasoning models.What Reasoning Models Excel At
Reasoning models are ideal for:- Complex problem-solving: Multi-step mathematical problems, logic puzzles, and analytical tasks
- Decision-making tasks: Evaluating options with highly interpretable and explicit thought processes
- Code generation and debugging: Writing, analyzing, and fixing code with clear explanations
- Scientific and technical analysis: Breaking down complex concepts and providing detailed explanations
Output Format
For each input row, reasoning models return a special JSON format that includes both the reasoning process and the final answer.- reasoning_content: Contains the model’s step-by-step thought process
- content: Contains the final answer or output
Basic Example
Using Reasoning Models with Structured Outputs
Reasoning models fully support structured outputs. When usingoutput_schema
, the schema applies to the content
field, while reasoning_content
remains as free-form text. This combination allows the model to full explore the problem or task at hand, while also offering strict adherence to a specified output forma:
Example with Pydantic Model
When using structured outputs with reasoning models, only the
content
field is validated against the schema. The reasoning_content
field always contains unstructured text showing the model’s thought process.Best Practices
- Leverage the reasoning: The
reasoning_content
field is valuable for debugging, education, and building trust in AI outputs - Crisp prompts: Reasoning models work best with explicit instructions that guide its thinking process, often phrases like “consider <important nuance of the problem>” can significantly boost performance and recall for nuanced tasks
- Structured outputs: Use schemas when you need the final answer in a specific format while preserving a “thinking canvas” to explore the problem space