output_model to delegate final response generation to a different model. The primary model handles research, reasoning, and tool calls, then the output model formats the final response.
Common use cases:
- Cost optimization: Use a powerful model for complex tasks, a cheaper model for formatting
- Specialized output: Use models optimized for different tasks (e.g., research vs. writing)
- Cross-provider: Combine models from different providers
Code
output_model.py
gpt-5.2) researches HackerNews using tools, then the output model (gpt-4o) formats the findings according to the prompt.
Usage
1
Set up your virtual environment
2
Install dependencies
3
Export your OpenAI API key
4
Run Agent