config `max_output_tokens` does not work
Resolved 💬 8 comments Opened Sep 24, 2025 by shallowclouds Closed Nov 24, 2025
💡 Likely answer: A maintainer (shallowclouds, contributor)
responded on this thread — see the highlighted reply below.
What version of Codex is running?
newest version in main, commit id: f7d2f3e54df95ecf8a7e1687a8e57ba16e23b27c
Which model were you using?
gpt-5
What platform is your computer?
linux
What steps can reproduce the bug?
- add
model_max_output_tokens = 40000in config.toml. - run hello world with codex
- capture the http request, there's no field for "max_output_tokens": 40000 in the responses api request body.
What is the expected behavior?
When user add the config item model_max_output_tokens in config.toml, the GPT responses API request should use the config.
What do you see instead?
capture the http request, there's no field for "max_output_tokens": 40000 in the responses api request body.
Additional information
I've check the code, the max_output_tokens in config struct is not used anywhere.
8 Comments
I meet the same issue
I meet the same issue
This appears to be a bug. When the API’s default max output tokens is set too low, it may trigger continuous retrying in the output stream. Please help review this PR. @aibrahim-oai
The pr is merged, we can use custom
max_output_tokensin config now.The pr was reverted due to some issues(please see https://github.com/openai/codex/pull/4139#issuecomment-3563874077), so I reopened this issue to continuely track this problem.
@etraut-openai Hello, do you have any suggestions for this issue? How could I fix the imcompatible of the patch?
I guess that someone may have
max_output_tokensin config before(which may be wrong), but because themax_output_tokendoes not work before, so it does not break anything util I merged the patch. 🤔🤔🤔@shallowclouds, we've decided to drop support for
max_output_tokensentirely. It has been removed from the documentation, and we don't plan to add it back (or accept any PRs that do).OK, so how could we config the max tokens then. Some LLM service may have a low default value, which often makes codex failed with error or imcomplete results.