Supported Thinking Models
Portkey currently supports thinking-enabled models from Anthropic, Google Vertex AI, Amazon Bedrock, OpenAI, Together AI, and other OpenAI-compatible providers. Note: If a specific model is not supported for thinking on Portkey, please reach out to us on Discord.Using Thinking Mode
- You must set
strict_open_ai_compliance=Falsein your headers or client configuration - The thinking response is returned in a different format than standard completions
- For streaming responses, the thinking content is in
response_chunk.choices[0].delta.content_blocks
Basic Example
- Python
- Node.js
- OpenAI SDK (JS)
- OpenAI SDK (Python)
- cURL
Multi-Turn Conversations
For multi-turn conversations, include the previous thinking content in the conversation history:Understanding Response Format
When using thinking-enabled models, be aware of the special response format:The assistant’s thinking response is returned in the
response_chunk.choices[0].delta.content_blocks array, not the response.choices[0].message.content string.When to Use Thinking Models
Thinking models are particularly valuable in specific use cases:- Complex problem solving: Break down multi-step tasks such as math, planning, debugging, or technical analysis where the model needs to reason through intermediate steps before answering.
- High-stakes decision support: Review contracts, policies, research, or operational runbooks where showing the reasoning path helps users audit the answer and catch missed assumptions.
- Long-context analysis: Compare multiple documents, synthesize evidence, or trace dependencies across large inputs where the model benefits from allocating tokens to structured reasoning.
- Agentic workflows: Power agents that need to plan tool calls, evaluate options, recover from errors, or explain why they chose a particular next step.
- Quality-sensitive generation: Produce answers that need stronger consistency, constraint following, and self-checking, such as code review, architecture recommendations, or data analysis.
budget_tokens based on the complexity of the task and the amount of reasoning you want returned.
FAQs
Can I use thinking mode with any model?
Can I use thinking mode with any model?
No, thinking mode is only available on specific reasoning-optimized models. Currently, this includes Claude 3.7 Sonnet and will expand to other models as they become available.
Does thinking mode increase token usage?
Does thinking mode increase token usage?
Yes, enabling thinking mode will increase your token usage since the model is generating additional content for its reasoning process. The
budget_tokens parameter lets you control the maximum tokens allocated to thinking.Do I need to handle the response differently for thinking mode?
Do I need to handle the response differently for thinking mode?
Yes, particularly for streaming responses. The thinking content is returned in the
content_blocks array rather than the standard content field, so you’ll need to adapt your response parsing logic.Why do I need to set strict_open_ai_compliance to false?
Why do I need to set strict_open_ai_compliance to false?
The thinking mode response format extends beyond the standard OpenAI completion schema. Setting
strict_open_ai_compliance to false allows Portkey to return this extended format with the thinking content.
