GPT-5.1 Codex Mini API: Endpoint & Pricing
Deprecated 23 Jul 2026GPT-5.1-Codex-Mini is an OpenAI code-focused model variant optimized for lightweight, fast software development assistance.
What is GPT-5.1-Codex-Mini?
GPT-5.1-Codex-Mini is a compact OpenAI model specialized for programming and code-centric tasks. It is mainly used for generating and refactoring code, writing small utilities or scripts, and assisting with algorithmic implementations across common programming languages. It is also suited for inline code assistance in IDEs or lightweight developer tools where latency and efficiency matter. It belongs to the Codex-style family of OpenAI models derived from general-purpose GPT systems and adapted for software development workloads.
Can you self-host GPT-5.1-Codex-Mini?
No. We found no public weights for GPT-5.1-Codex-Mini on Hugging Face, so there is nothing to download, quantize or serve on your own GPUs: no VRAM budget, no vLLM or GGUF build to plan for. The only way to run it is over an API.
Skip the deploy — use LLM.API as your endpoint
No GPUs, no quantization trade-offs. Same model, OpenAI-compatible, up to 30% below list price.
Providers
Different companies host the same model. OpenRouter routes your request to one of them based on the routing mode you pick — Balanced (price + speed), Nitro (fastest), or Exacto (highest tool-calling accuracy).
List price by provider
InputOutputProvider list prices; the LLM.API discount applies on top.
| Provider | Input | Output | Cache read /M | Latency | Throughput | Uptime |
|---|---|---|---|---|---|---|
| azure | in $0.25; out $2 per 1M tokens | 400K tokens | vision, tools, streaming, reasoning, web search, JSON, structured |
Prices and availability from the LLMAPI catalogue, updated nightly. Last updated 11 Oct 2026.
Try this model
Test GPT-5.1-Codex-Mini right here — free to start.
Suggestions for your first prompt
Code snippet
Call the model through the OpenAI-compatible API.
Switching from OpenAI? Change 2 lines.
- base_url="https://api.openai.com/v1"
- api_key="YOUR_OPENAI_KEY"
+ base_url="https://api.llmapi.ai/v1"
+ api_key="YOUR_LLMAPI_KEY"Everything else stays the same — SDK, message format, tools, streaming. Set model to gpt-5.1-codex-mini and the call runs unchanged.
curl https://api.llmapi.ai/v1/chat/completions \
-H "Authorization: Bearer $LLMAPI_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-5.1-codex-mini",
"messages": [
{"role": "user", "content": "Give me three crisp launch checklist items."}
],
"reasoning_effort": "none"
}'from openai import OpenAI
client = OpenAI(
api_key="YOUR_LLMAPI_KEY",
base_url="https://api.llmapi.ai/v1",
)
resp = client.chat.completions.create(
model="gpt-5.1-codex-mini",
messages=[
{"role": "system", "content": "You are a precise product assistant."},
{"role": "user", "content": "Give me three crisp launch checklist items."},
],
reasoning_effort="none",
)
print(resp.choices[0].message.content)import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.LLMAPI_KEY,
baseURL: "https://api.llmapi.ai/v1",
});
const resp = await client.chat.completions.create({
model: "gpt-5.1-codex-mini",
messages: [
{ role: "user", content: "Give me three crisp launch checklist items." },
],
});
console.log(resp.choices[0].message.content);stream = client.chat.completions.create(
model="gpt-5.1-codex-mini",
messages=[{"role": "user", "content": "Write a haiku about latency."}],
stream=True,
)
for chunk in stream:
delta = chunk.choices[0].delta.content
if delta:
print(delta, end="", flush=True){
"model": "gpt-5.1-codex-mini",
"messages": [
{"role": "system", "content": "You are a precise product assistant."},
{"role": "user", "content": "Give me three crisp launch checklist items."}
],
"reasoning_effort": "none"
}ENDPOINTS
Supported endpoints & features
Base URL https://api.llmapi.ai/v1 · model ID gpt-5.1-codex-mini · OpenAI-compatible.
POST /v1/chat/completionsChat Completions — supported
| Feature | Status | How to set it |
|---|---|---|
| Function calling (tools) | Supported | tools, tool_choice |
| Parallel tool calls | Not supported | parallel_tool_calls |
| JSON mode | Supported | response_format: {"type": "json_object"} |
| Structured outputs | Supported | response_format: {"type": "json_schema", …} |
| Streaming | Supported | stream: true |
| Vision (image input) | Supported | image_url content parts |
| Web search | Supported | web_search |
| Reasoning effort | none · low · medium · high | reasoning_effort: "none" |
ERRORS
Errors & fallback routing
| Code | What it means | What to do |
|---|---|---|
401 | Missing or invalid API key. | Send Authorization: Bearer YOUR_LLMAPI_KEY and check the key is active. |
429 | Rate limited, or the upstream provider is throttling the request. | Back off and retry with jitter; the gateway also retries the request on another provider where one is available. |
5xx | Upstream provider error or timeout. | Retry; fallback routing sends the retry to the next healthy provider for this model. |
When a provider fails or throttles, the request is routed to the next provider serving this model — the ones listed in the providers table above.
Uptime
Last 30 days
26/30 days operational | 96.70% uptime
GPT-5.1 Codex Mini in production
What the model is good at.
-
Conversational Chat
Engages in multi-turn English conversations, following instructions, asking clarifying questions, and maintaining context over extended dialogues.
-
Code Generation
Writes and completes code snippets or small programs in popular languages based on natural language specifications and examples.
-
Text Translation
Translates between major natural languages, preserving meaning and tone while following instructions to always answer in English.
-
Image Understanding
Interprets images by identifying objects, text, and relationships, and answers questions about visual content described in prompts.
-
Visual OCR
Extracts readable text content from images of documents, signs, or screens, enabling downstream search, editing, or analysis.
What you get when you call GPT-5.1 Codex Mini through LLM.API.
-
Unified AI Routing
Define intent once and let LLM.API automatically route to the best model across providers based on latency, cost, and performance—no client changes required.
One endpoint, any model -
Smart Cost Controls
Mix premium and budget models behind one API, enforce spend guardrails, and dynamically down-tier requests so you never blow your inference budget again.
Optimize every token -
Automatic Fallback Logic
Survive provider outages and rate limits with built-in retries and cross-vendor failover, keeping your AI workflows up without brittle custom logic.
Resilient by default -
Deep Observability
Trace every request across providers with logs, metrics, and structured events so you can debug failures, tune prompts, and prove reliability to stakeholders.
See every token -
Task-Level Orchestration
Model your AI work as tasks—classification, extraction, generation—and let LLM.API pick the right tools, prompts, and models for each step automatically.
Tasks, not raw calls -
High-Throughput Batch
Ship millions of inferences via a single batch job with parallel execution, retry semantics, and cost-efficient pricing tuned for large-scale workloads.
Scale without throttling
When to Use — When NOT to Use
Use it if...
- You need a lightweight model to write, refactor, or document small code snippets.
- You need inexpensive code completion for editors, CLIs, or quick prototyping tools.
- Your use case involves generating simple utility scripts or glue code between APIs.
- Your use case involves adding inline comments or docstrings to existing codebases.
- You need fast iterations on small coding tasks where perfect reasoning is unnecessary.
- Your use case involves teaching basic programming concepts with short, focused examples.
Avoid if...
- You need state-of-the-art performance on complex multi-file software design and architecture decisions.
- Your workload requires deep algorithmic reasoning, proofs, or highly optimized low-level systems code.
- You need reliable handling of very long context windows containing large codebases or logs.
- Your workload requires advanced non-coding capabilities like image understanding or multimodal reasoning.
- You need the strongest available security, privacy, and compliance guarantees for sensitive code.
- Your workload requires precise natural-language reasoning beyond simple explanations or code-related Q&A.
COMMUNITY
What developers say about GPT-5.1-Codex-Mini
Summarised from public developer discussions and write-ups. Opinions are the sources’, not LLM.API’s.
- Developers on GitHub indicate that GPT-5.1-Codex-Mini is optimized for codex environments, being faster and more cost-effective than flagship versions but providing lower overall capability for complex reasoning.
- Developers in technical discussions report that the model is well-suited for high-volume tasks like automated code review and routine programming where budget efficiency is prioritized over frontier performance.
- Developers on GitHub have noted that while the model is excellent for tool-calling, it may lack the 'agentic' autonomy of larger models, sometimes stopping to ask for user direction.
SOURCES
Frequently Asked Questions
-
What is GPT-5.1-Codex-Mini?
GPT-5.1-Codex-Mini is a lightweight OpenAI code-focused language model optimized for fast, low-cost software development and automation workloads.
-
What is GPT-5.1-Codex-Mini best suited for?
It excels at code generation, refactoring, debugging, writing tests, and explaining source code across popular programming languages and frameworks.
-
What is the context window of GPT-5.1-Codex-Mini?
GPT-5.1-Codex-Mini supports a 32K token context window, allowing it to handle large files or multi-file code snippets in a single request.
-
How fast is GPT-5.1-Codex-Mini in terms of latency?
As a mini variant, it is tuned for low latency responses, making it suitable for interactive coding tools and real-time developer assistants.
-
What modalities does GPT-5.1-Codex-Mini support?
GPT-5.1-Codex-Mini supports text-only inputs and outputs, focusing specifically on natural language and source code rather than images or audio.
-
How is GPT-5.1-Codex-Mini priced on LLM.API?
LLM.API exposes GPT-5.1-Codex-Mini with per-token pricing; check your LLM.API dashboard or pricing docs for current input and output rates.
-
How do I call GPT-5.1-Codex-Mini through LLM.API?
Use the LLM.API completion or chat endpoint, specifying the provider as OpenAI and the model identifier GPT-5.1-Codex-Mini in your request payload.
-
How does GPT-5.1-Codex-Mini compare to larger GPT-5.1 models?
Compared to larger GPT-5.1 variants, Codex-Mini trades some reasoning depth for significantly lower cost and faster responses on typical coding tasks.
-
Does GPT-5.1-Codex-Mini have any notable limitations?
It can hallucinate APIs, produce insecure patterns, or misunderstand incomplete specs, so you must review, test, and secure all generated code.
-
Can GPT-5.1-Codex-Mini handle long multi-step coding instructions?
It handles moderately long, structured instructions well, but extremely complex multi-step projects may require chunking tasks across several calls.
COMPARE
Competitive Models
GPT-5 Mini
$0.25 in / $2 out per 1M tokens, 400,000 context — the closest current alternative to GPT-5.1 Codex Mini.
Codestral
$0.3 in / $0.9 out per 1M tokens, 256,000 context — the closest current alternative to GPT-5.1 Codex Mini.
Qwen3.8 Flash Next
$0.201 in / $0.5 out per 1M tokens, 262,144 context — the closest current alternative to GPT-5.1 Codex Mini.
GPT-5.2 Chat is an OpenAI conversational language model designed for interactive dialogue and task assistance. It focuses on providing coherent, context-aware responses across a wide range of topics.
GPT-5.5
Up to 30%GPT-5.5 is an OpenAI model; as of mid-2026, OpenAI has not publicly released technical details or documentation about this specific version.
GPT-5.1
Up to 30%GPT-5.1 is an OpenAI language model; as of mid-2026, OpenAI has not publicly released technical details or documentation about it.
Get one key to every model
Swap your API key. Keep your code.