gpt-5.1-codex — Deprecated
- Deprecated
- —
- Shutdown
- 2026-07-23
- Status
- deprecated
- Replacement
- gpt-5
Quick fix — copy & paste
Choose your language. The "before" block matches the deprecated call; the "after" block is the drop-in replacement.
# OpenAI: gpt-5.1-codex (deprecated)
model = "gpt-5.1-codex" # Replacement
model = "gpt-5" // OpenAI: gpt-5.1-codex (deprecated)
const model = "gpt-5.1-codex"; // Replacement
const model = "gpt-5"; "model": "gpt-5.1-codex" "model": "gpt-5" This migration was generated automatically from the model rename. If your code does more than swap a model id, double-check request/response shapes against the official OpenAI migration guide.
Error messages
Seeing one of these? You're in the right place.
-
model_not_found: gpt-5.1-codex -
The model `gpt-5.1-codex` has been deprecated -
The model `gpt-5.1-codex` does not exist or you do not have access to it
Replacement options
-
gpt-5Compare token cost →
Other OpenAI deprecations
What this means for your code
gpt-5.1-codex is a code-completion or code-specific model used for IDE integrations. Code models often have different context window sizes, tokenization, and stop-sequence handling. Replacements may change the prompt format expected for FIM (fill-in-the-middle) completions.
OpenAI has scheduled gpt-5.1-codex for shutdown on 2026-07-23. That gives you 76 days to migrate. Until then the model still works, but every API call after that date will return a model_not_found error.
Find every call in your codebase
Before you change anything, locate every place the deprecated model id is referenced. Search source files, environment files, feature flags, and config repos. Use these commands from your project root:
Python projects
grep -rn '"gpt-5.1-codex"' --include="*.py" . JavaScript / TypeScript projects
grep -rn '"gpt-5.1-codex"' --include="*.{js,ts,tsx,jsx}" . Anywhere (configs, scripts, infra)
grep -rn "gpt-5.1-codex" . Migration checklist
Steps in order. Skip any that don't apply, but read the whole list — for code models, the non-obvious steps are usually the ones that break in production.
- 1. Update the model id in your code-completion service
- 2. Verify FIM markers (<|fim_prefix|> etc.) are supported by the new model
- 3. Re-test completions on representative source files in your supported languages
- 4. Recompute cost per accepted suggestion using new tokenizer + new pricing
- 5. Update any client-side cache keys that include the model id
Will this migration cost more?
Switching from gpt-5.1-codex to gpt-5 could change your costs significantly. Calculate the exact difference for your prompts.
Open the cost calculator →