Skip to content

max_tokens must be at least 1, got -1712 — Codex

Quick fix

The original post only suggested a lower-bound check for max_tokens; no verified fix or user-usable configuration is available.

Error output
CC Switch local proxy failed while handling Codex endpoint /responses.
Provider: NVIDIA GPT-OSS 120B; model: openai/gpt-oss-120b;
upstream_status: HTTP 400;
cause: max_tokens must be at least 1, got -1712.
(parameter=max_tokens, value=-1712)

The report states that when Codex sends requests through the `/responses` endpoint, CC Switch converts them to `/chat/completions`; `max_output_tokens` is mapped to `max_tokens` without validating that it is positive. The report observed that the negative value changed after restarts, suggesting a dynamic calculation or overflow issue rather than a fixed configuration error.

The original post suggested falling back to the provider default or a fixed positive value when `max_tokens` is below 1 before forwarding, and adding a forced override option in the Provider UI. These are reporter suggestions only; there is no maintainer confirmation, merged change, or successful user verification. The issue was automatically closed after prolonged inactivity, so it cannot be considered fixed.

  1. The original post does not provide a verifiable solution. You can follow or reopen Issue #4714 and provide maintainers with the actual negative `max_tokens` value seen in the Codex `/responses` request. The proposed lower-bound check is only a suggestion and has not been confirmed as implemented.

ToolCodex
Versionv3.16.4(报告受影响)
PlatformsUnknown

(No FAQ yet)

This is an unofficial community wiki with no affiliation to the cc-switch authors or the project itself. Its content is compiled from the project's public GitHub issues. This site distributes no software.