# GPT 5.1 Codex Mini

The fast, affordable member of the GPT-5.1 codex family, built for routine coding tasks at a price point that makes per-PR and per-commit automation practical.

- **Model ID:** `openai/gpt-5.1-codex-mini`
- **Type:** chat
- **Providers:** azure
- **Context window:** 400,000
- **Maximum output tokens:** 128,000
- **Pricing:** $0.25/1M input tokens, $2/1M output tokens
- **Canonical page:** https://vercel.com/ai-gateway/models/gpt-5.1-codex-mini

## Supported parameters

Detailed capability metadata has not been reported for this model.

## Example

```ts
import { streamText } from 'ai'

const result = streamText({
  model: 'openai/gpt-5.1-codex-mini',
  prompt: 'Why is the sky blue?'
})
```

## About

GPT 5.1 Codex Mini was released on November 12, 2025 as the affordable, fast option in the GPT-5.1 codex family on AI Gateway. It targets the high-volume, routine coding tasks that make up the bulk of development work: fixing bugs, implementing straightforward features, generating tests, and providing code review feedback.

As the mini variant, it prioritizes speed and cost over maximum reasoning depth. This makes it practical to deploy as always-on automation that runs on every code change rather than being reserved for complex tasks. The model still benefits from the GPT-5.1 generation's improvements over earlier models.

It operates in the same sandboxed agentic environment as other codex variants, with the ability to read repositories, write code, execute tests, and iterate. The context window of 400K tokens gives it enough room to understand the relevant portions of a codebase for most routine tasks.

## What to consider

GPT 5.1 Codex Mini is priced for high-frequency use. Running it on every pull request, commit, or code change is economically viable, enabling continuous automated coding assistance.

It handles the majority of everyday coding tasks well. Escalate to standard codex or codex max only when the task's complexity warrants it.

## When to use

### Best For

- **Per-PR code review:** Automated suggestions on every pull request at sustainable cost
- **Bug fix automation:** Routine bug fixes with clear reproduction steps
- **Feature scaffolding:** Generating boilerplate and implementing straightforward features
- **Test generation:** Creating test cases for existing code
- **CI integration:** Continuous coding assistance embedded in development pipelines

### Consider Alternatives When

- **Complex refactoring:** Standard GPT-5.1 codex for multi-file architectural changes
- **Critical code audits:** Codex max for security-sensitive or high-stakes reviews
- **Non-coding tasks:** GPT-5.1 instant for general-purpose fast inference
- **Maximum reasoning depth:** o3 or o4-mini for problems requiring extended chain-of-thought

## Best for

- **Per-PR code review:** Automated suggestions on every pull request at sustainable cost
- **Bug fix automation:** Routine bug fixes with clear reproduction steps
- **Feature scaffolding:** Generating boilerplate and implementing straightforward features
- **Test generation:** Writing unit and integration test cases that cover existing code paths
- **CI integration:** Continuous coding assistance embedded in development pipelines

## Consider alternatives

- **Complex refactoring:** Standard GPT-5.1 codex for multi-file architectural changes
- **Critical code audits:** Codex max for security-sensitive or high-stakes reviews
- **Non-coding tasks:** GPT-5.1 instant for general-purpose fast inference
- **Maximum reasoning depth:** o3 or o4-mini for problems requiring extended chain-of-thought

## Frequently asked questions

### How does GPT 5.1 Codex Mini compare to standard GPT-5.1 codex?

It's faster and cheaper but with less reasoning depth. It handles routine tasks well and is designed for high-frequency use in CI pipelines and development workflows.

### Is GPT 5.1 Codex Mini good enough for code review?

Yes, for standard code review. For security audits or architecturally complex changes, escalate to standard codex or codex max.

### What context window does GPT 5.1 Codex Mini support?

400K tokens, sufficient for understanding the relevant portions of most codebases.

### How does AI Gateway handle authentication for GPT 5.1 Codex Mini?

AI Gateway accepts a single API key or OIDC token for all requests. You don't embed OpenAI credentials in your application; AI Gateway routes and authenticates on your behalf.

### Can I run GPT 5.1 Codex Mini on every commit?

Yes. Its pricing is designed to make per-commit and per-PR automation economically viable.

### What are typical latency characteristics?

This page shows live throughput and time-to-first-token metrics measured across real AI Gateway traffic.

## Links

- [Model page](https://vercel.com/ai-gateway/models/gpt-5.1-codex-mini)
- [AI Gateway documentation](https://vercel.com/docs/ai-gateway)
- [Provider model documentation](https://azure.microsoft.com/en-us/pricing/details/cognitive-services/openai-service)
- [Provider pricing](https://azure.microsoft.com/en-us/pricing/details/cognitive-services/openai-service)
