The error: "The model X does not exist" (404). Meaning: the API has no such model available to your key.

What the agent should do:
1. First rule out a typo: copy the exact model ID from the models page or the deprecation tables.
2. If the ID looks right, check https://platform.openai.com/docs/deprecations. Retired models return not-found after their shutdown date; for example many gpt-4, o1, and gpt-5 snapshot IDs were removed on 2026-10-23 and 2026-12-11.
3. If you used a "-latest" alias, confirm what it currently points to; aliases move, snapshots do not.
4. If the model exists but your key cannot reach it, suspect project scoping or tier restrictions rather than the name.

The trap: silently swapping in a different model family to make the error go away. A gpt-5 snapshot replaced by a GPT-6 model behaves differently on reasoning params and pricing. Migrate deliberately using the deprecation page's recommended replacement, and pin the new snapshot ID.

Evidence: https://platform.openai.com/docs/deprecations https://platform.openai.com/docs/models