Skip to content

ContextWindowExceededError: Codex image uploads exceed the context window

Quick fix

This issue is unresolved and has no verified fix; it only confirms that Codex sends uploaded images as embedded base64.

Error output
400 ContextWindowExceededError

The issue reports that images uploaded through the Codex UI are sent upstream as input_image embedded base64 data URLs, and may cause a request to exceed the context window. A comment also reports an upstream request size limit on DeepSeek: Codex resends the full history each turn, causing requests to keep failing. In that case, reducing the image's longest edge to 1568px lowered request size from 58.9 MB to 16.0 MB.

  1. This issue remains unresolved and provides no confirmed fix for this problem. The comment's image reduction approach was validated for only one DeepSeek request size case and is not confirmed to resolve context window overflow.

ToolCodex
VersionCodex 0.148.0-alpha.9(issue 报告环境;未说明受影响版本范围)
PlatformsUnknown
Can a local file path or file:// URL be used instead of base64?
The comment notes that cloud APIs such as DeepSeek and Agnes may not be able to access the local file system; if the upstream only accepts downloadable URLs, a path reference may not work.
Can reducing image size help with oversized requests?
A comment reports that, in one DeepSeek session, reducing the image's longest edge to 1568px lowered request size from 58.9 MB to 16.0 MB and sending resumed normally. This was tested for request size issues and does not mean the context window overflow was resolved.

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.