o4-mini
o4-mini advances OpenAI's compact reasoning model line with stronger performance and greater efficiency than o3-mini, adding native tool use and image reasoning.
import { streamText } from 'ai'
const result = streamText({ model: 'openai/o4-mini', prompt: 'Why is the sky blue?'})Playground
Try out o4-mini by OpenAI. Usage is billed to your team at API rates. Free users (those who haven't made a payment) get $5 of credits every 30 days.
o4-mini
Providers
Route requests across multiple providers. Copy a provider slug to set your preference. Visit the docs for more info. Using a provider means you agree to their terms, listed under Legal.
| Provider |
|---|
P50 throughput on live AI Gateway traffic, in tokens per second (TPS). Visit the docs for more info.
P50 time to first token (TTFT) on live AI Gateway traffic, in milliseconds. View the docs for more info.
Direct request success rate on AI Gateway and per-provider. Visit the docs for more info.
More models by OpenAI
| Model |
|---|
About o4-mini
o4-mini was released on April 16, 2025 alongside o3 as a cost-efficient reasoning model from OpenAI. It advances the compact reasoning model line (following o1-mini and o3-mini) with improvements across reasoning quality, efficiency, and multimodal capability.
A key advancement is native vision support: o4-mini can reason over images, diagrams, mathematical notation, and screenshots, combining visual understanding with chain-of-thought analysis. Earlier mini reasoning models were text-only. This opens up visual reasoning tasks at the affordable mini-tier pricing.
The model supports function calling and tool use, making it suitable as the reasoning layer in lightweight agent architectures. Combined with the reasoning_effort parameter, it lets you build cost-optimized pipelines that apply just enough reasoning to each request.
What To Consider When Choosing a Provider
- Configuration: o4-mini incorporates advances beyond o3-mini, including native vision support. It's a strong option for projects that need affordable chain-of-thought reasoning.
- Configuration: Unlike earlier mini reasoning models, o4-mini natively supports vision input, enabling reasoning over images, diagrams, and documents.
- Zero Data Retention: AI Gateway supports Zero Data Retention for this model via direct gateway requests (BYOK is not included). To configure this, check the documentation.
- Authentication: AI Gateway authenticates requests using an API key or OIDC token. You do not need to manage provider credentials directly.
When to Use o4-mini
Best for
- Affordable chain-of-thought reasoning: Per-request deliberation on technical tasks at scale
- Visual reasoning: Analyzing diagrams, charts, mathematical notation, and screenshots with step-by-step thinking
- Tool-using agents: Lightweight reasoning backbone for agents that call external tools and APIs
- Math and code reasoning: Competition-level problems and algorithmic analysis at accessible cost
- Mixed-difficulty pipelines: Using
reasoning_effortto optimize cost across varied query complexity
Consider alternatives when
- Maximum reasoning depth: O3 or o3-pro for the hardest problems requiring exhaustive deliberation
- General-purpose tasks: GPT-5 mini for workloads that don't benefit from chain-of-thought
- Coding agent workflows: Codex models for autonomous software engineering
- Non-reasoning speed: GPT-5.1 instant for the fastest possible general-purpose responses
Conclusion
o4-mini combines stronger reasoning performance than o3-mini with native vision and tool use at an affordable price point. For technical workloads on AI Gateway that need per-request reasoning with multimodal support, it advances the cost-efficient reasoning tier.