[BUG] gpt-5-codex model returns 404 error when using v1/chat/completions endpoint

Resolved 💬 2 comments Opened Sep 30, 2025 by BEOKS Closed Sep 30, 2025

What version of Codex is running?

Codex CLI v0.42.0

Which model were you using?

gpt-5-codex

What platform is your computer?

Darwin 24.5.0 arm64 arm

What steps can reproduce the bug?

  1. Run codex command
  2. Use API key authentication
  3. Change model to gpt-5-codex using /model command
  4. Send any message (e.g., "hello")
  5. Observe the 404 error with retry attempts

What is the expected behavior?

The gpt-5-codex model should work properly with the Codex CLI without returning 404 errors. The model should respond to user queries successfully.

What do you see instead?

⚠️ stream error: unexpected status 404 Not Found: {
"error": {
"message": "This model is only supported in v1/responses and not in v1/chat/completions.",
"type": "invalid_request_error",
"param": "model",
"code": null
}
}; retrying 1/5 in 183ms…

⚠️ stream error: unexpected status 404 Not Found: {
"error": {
"message": "This model is only supported in v1/responses and not in v1/chat/completions.",
"type": "invalid_request_error",
"param": "model",
"code": null
}
}; retrying 2/5 in 380ms…

Additional information

The error message clearly indicates that the gpt-5-codex model is only supported in the v1/responses endpoint, not in v1/chat/completions. This suggests that Codex CLI is using the wrong API endpoint for this specific model.

The system automatically retries the request (up to 5 times) but continues to fail with the same 404 error. This appears to be a configuration issue where Codex CLI needs to use the correct API endpoint for the gpt-5-codex model.

Environment:

  • macOS 24.5.0 (Sequoia)
  • Codex CLI v0.42.0
  • Model: gpt-5-codex
  • Working directory: ~/IdeaProjects/security-portal

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗