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?

  1. add model_max_output_tokens = 40000 in config.toml.
  2. run hello world with codex
  3. 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.

View original on GitHub ↗

8 Comments

initiald0824 · 9 months ago

I meet the same issue

SDGLBL · 9 months ago

I meet the same issue

s-JoL · 8 months ago

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

shallowclouds contributor · 8 months ago

The pr is merged, we can use custom max_output_tokens in config now.

shallowclouds contributor · 7 months ago

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.

shallowclouds contributor · 7 months ago

@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_tokens in config before(which may be wrong), but because the max_output_token does not work before, so it does not break anything util I merged the patch. 🤔🤔🤔

etraut-openai contributor · 7 months ago

@shallowclouds, we've decided to drop support for max_output_tokens entirely. It has been removed from the documentation, and we don't plan to add it back (or accept any PRs that do).

shallowclouds contributor · 7 months ago
@shallowclouds, we've decided to drop support for max_output_tokens entirely. 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.