OpenAI rejected the request. Error details: Status: 400, Code: unknown, Type: unknown, Message: 400 status code (no body)

Resolved 💬 4 comments Opened May 9, 2025 by fitchmultz Closed Aug 7, 2025

What version of Codex is running?

0.1.2504301751

Which model were you using?

gemini-2.5-pro-preview-05-06

What platform is your computer?

darwin | arm64 | 24.4.0

What steps can reproduce the bug?

  • OpenAI rejected the request. Error details: Status: 400, Code: unknown, Type: unknown, Message: 400 status code (no body)
  • ```

mandatory minimum of 10 tool calls per turn. identify ALL types, schemas, interfaces, enums defined in apps/api/**/* that SHOULD ideally be in packages/shared/src as they are likely relevant to both the api and apps/web (frontend)
```

  • 0 reasoning | 2 tool
  • ```

try again
```

  • 0 reasoning | 0 tool

What is the expected behavior?

_No response_

What do you see instead?

_No response_

Additional information

_No response_

View original on GitHub ↗

4 Comments

MarcoMuellner · 1 year ago

Same here. Here are some debug statements i got:

OpenAI:DEBUG:request https://generativelanguage.googleapis.com/v1beta/openai/models { method: 'get', path: '/models' } {
  accept: 'application/json',
  'content-type': 'application/json',
  'user-agent': 'Nr/JS 4.95.1',
  'x-stainless-lang': 'js',
  'x-stainless-package-version': '4.95.1',
  'x-stainless-os': 'MacOS',
  'x-stainless-arch': 'arm64',
  'x-stainless-runtime': 'node',
  'x-stainless-runtime-version': 'v22.14.0',
  authorization: 'REDACTED',
  'x-stainless-retry-count': '0',
  'x-stainless-timeout': '600'
}
OpenAI:DEBUG:response (error; (error; no more retries left)) 400 https://generativelanguage.googleapis.com/v1beta/openai/models {
  'alt-svc': 'h3=":443"; ma=2592000,h3-29=":443"; ma=2592000',
  'content-encoding': 'gzip',
  'content-type': 'application/json; charset=UTF-8',
  date: 'Fri, 09 May 2025 18:32:03 GMT',
  server: 'scaffolding on HTTPServer2',
  'server-timing': 'gfet4t7; dur=25',
  'transfer-encoding': 'chunked',
  vary: 'Origin, X-Origin, Referer',
  'x-content-type-options': 'nosniff',
  'x-frame-options': 'SAMEORIGIN',
  'x-xss-protection': '0'
} 

I assume the url is wrong, as this is the curl script from the documentation of gemini:

curl "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash:generateContent?key=GEMINI_API_KEY" \
-H 'Content-Type: application/json' \
-X POST \
-d '{
  "contents": [{
    "parts":[{"text": "Explain how AI works"}]
    }]
   }'
chriswingler · 1 year ago
Same here. Here are some debug statements i got: `` OpenAI:DEBUG:request https://generativelanguage.googleapis.com/v1beta/openai/models { method: 'get', path: '/models' } { accept: 'application/json', 'content-type': 'application/json', 'user-agent': 'Nr/JS 4.95.1', 'x-stainless-lang': 'js', 'x-stainless-package-version': '4.95.1', 'x-stainless-os': 'MacOS', 'x-stainless-arch': 'arm64', 'x-stainless-runtime': 'node', 'x-stainless-runtime-version': 'v22.14.0', authorization: 'REDACTED', 'x-stainless-retry-count': '0', 'x-stainless-timeout': '600' } OpenAI:DEBUG:response (error; (error; no more retries left)) 400 https://generativelanguage.googleapis.com/v1beta/openai/models { 'alt-svc': 'h3=":443"; ma=2592000,h3-29=":443"; ma=2592000', 'content-encoding': 'gzip', 'content-type': 'application/json; charset=UTF-8', date: 'Fri, 09 May 2025 18:32:03 GMT', server: 'scaffolding on HTTPServer2', 'server-timing': 'gfet4t7; dur=25', 'transfer-encoding': 'chunked', vary: 'Origin, X-Origin, Referer', 'x-content-type-options': 'nosniff', 'x-frame-options': 'SAMEORIGIN', 'x-xss-protection': '0' } ` I assume the url is wrong, as this is the curl script from the documentation of gemini: ` curl "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash:generateContent?key=GEMINI_API_KEY" \ -H 'Content-Type: application/json' \ -X POST \ -d '{ "contents": [{ "parts":[{"text": "Explain how AI works"}] }] }' ``

Same issue. error 400.

The cURL script in Google AI Studio isn't the OpenAI compatible one. However, in the Google documentation it shows they are OpenAI compatible, i.e. using /openai in the url:

https://ai.google.dev/gemini-api/docs/openai#javascript

Mondonno · 1 year ago

I have the same error with devstral-small-2505 provider: mistral

codex-maintainers · 1 year ago

Thank you for the feedback. Please try again with the latest version of Codex CLI. If the issue persists, let us know!