Range of input length should be [1, 1048576] - Codex
Quick fix
Upgrade CC Switch to v3.19.0 for the fix where images were forwarded as base64 text and inflated tokens, or avoid view_image under the proxy.
Symptom
Section titled “Symptom”HTTP 400 InternalError.Algo.InvalidParameter: Range of input length should be [1, 1048576]When Codex uses `wire_api = "responses"` through the CC Switch local proxy, images produced by tool calls such as `view_image` are stuffed into the request as a plain text string (base64) by the conversion layer. That inflates one image by thousands of times in tokens, filling the context fast and triggering a 400.
Separately, domestic models (GLM, Doubao) differ in their support for the OpenAI-compatible endpoint, producing other 400 variants: the `detail: "original"` image parameter newer Codex sends not being supported (only `low`/`high`/`xhigh`/`auto` are), or the request carrying a `reasoning` parameter the model does not support.
Upgrade CC Switch to v3.19.0 or newer. That version fixed the conversion bridge to extract images from tool results and send them in native image format rather than as base64 text.
If you cannot upgrade yet, avoid the `view_image` tool under the proxy and extract text directly with `pdftotext`, `pdfplumber`, or similar.
For a `reasoning is not supported` error, remove the `model_reasoning_effort` option from the config.
For an `invalid value: 'original'` error, wait for official support, or use a local proxy to rewrite `detail: "original"` into `auto` as a stopgap.
Affected Versions
Section titled “Affected Versions”Source Issues
Section titled “Source Issues”This page is distilled from 3 real issues
- Why does `reasoning is not supported` persist after upgrading?
- Because the model itself does not support the reasoning parameter — remove the `model_reasoning_effort` field from the config.
- Doubao or GLM report `invalid value: 'original'`. How do I resolve it?
- Newer Codex sends `detail: "original"` by default, which some domestic models do not support. Rewrite `detail: "original"` into `auto` with a local proxy as a stopgap, or wait for a later CC Switch version to support it.
- Is image handling back to normal after upgrading CC Switch?
- Yes. v3.19.0 changed every conversion bridge to extract images and send them in native format, with only a placeholder left in the tool message, resolving the token inflation.
Related problems
Section titled “Related problems”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.