What Codex Actually Sends to the Model (10-Minute Read)
Key point
Codex sent a request of approximately 9,435 tokens to the model for an input of just 16 characters.
Details
Codex CLI 0.145.0 was measured using a local HTTP recorder to capture the actual request sent to the model while processing a 16-character input of Reply with pong.. No external models were called. The captured JSON body was 42,980 bytes, which is approximately 9,435 tokens based on the local o200k_base tokenizer. The user's input prompt accounted for approximately 25 tokens, or just 0.3% of the total.
The majority of the request consisted of data added by Codex itself.
- Tool definitions: approximately 3,942 tokens
- Codex default instructions: approximately 3,729 tokens
- User message: approximately 25 tokens
The default request included four top-level tool items: exec, wait, request_user_input, and the collaboration namespace. However, it actually described more behaviors, including six sub-tools within the collaboration namespace and features for command execution, patching, image inspection, and plan updates. In this execution, tools and default instructions were placed inside the input array rather than as top-level fields.
Project instructions are automatically composed by combining AGENTS.md files from the repository root down to the nearest path relative to the execution directory. Starting from the root sends only the root instructions, while starting from a subdirectory sends both root and subdirectory instructions. However, running ls child subsequently did not automatically add the subdirectory's instructions.
Adding 250 synthetic markers increased the request to 48,927 bytes and 11,965 tokens, while adding 1,000 markers resulted in 67,177 bytes and 20,465 tokens. In a trace where two requests occurred, the same 250 instructions were included in both requests.
Repository file reads and command outputs are added to the conversation history after the initial request. If the history becomes too large, Codex can summarize the history via a separate model request, replace the existing content with the summary, and continue the task. The measured token counts are local estimates only and do not represent API usage or billing criteria; the actual caching, post-processing, and billing methods applied by the provider cannot be confirmed.
This summary was generated automatically by AI. Check the original for the author's claims and context. Copyright belongs to the original author.
Our guide explains how the AI works. Report summary errors, attribution issues, or removal requests via Contact.