Skip to content

OpenAI

The prompt is 0.3% of what Codex sends

9 min read

Written by an AI model from the linked sources and checked against them by a second model. How we work

All about: OpenAI models and products →
Image: 0xkato.xyz

The researcher who writes as 0xkato typed a 16-character prompt, Reply with pong., into Codex CLI. The request that went out was 42,980 bytes. That is roughly 9,435 tokens, and the prompt itself, once wrapped, made up about 25 of them. The rest of the experiment explains where those tokens come from, and which parts of a repository, a terminal and an image get added to every later request once an agent session starts doing work.

The method, laid out in 0xkato’s August 4 write-up, is simple. Codex supports custom model providers, so the author pointed it at a local HTTP server that saved each request, redacted sensitive headers and returned a fixed fake response. No external model was called. Two things were measured: the raw size of the HTTP JSON body, and an approximate token count from encoding the sanitized JSON locally with o200k_base. The byte counts are exact. The token counts are estimates, not API usage or billing, and the recorder can’t see what a real provider does after the request arrives, what it caches, or how it bills. The tests ran on Codex CLI 0.145.0 with gpt-5.6-sol.

Where the first 9,435 tokens go

The baseline ran in an empty temporary Git repository with project instructions disabled and CODEX_HOME pointed at an empty directory. Even so, the request described five bundled system skills, so the author calls it an isolated-home baseline rather than the smallest request possible.

Three items accounted for 7,696 of the 9,435 tokens:

  • a developer item holding the tool definitions: 16,741 characters, about 3,942 tokens;
  • the main Codex instructions as a developer message: 17,730 characters, about 3,729 tokens;
  • the user message: 16 characters, about 25 tokens.

There were only four top-level tool entries: exec, wait, request_user_input and a collaboration namespace. They cover a lot more than four actions. collaboration holds six subtools, and exec describes command execution, patching, image inspection, plan updates and other nested tools. In this run Codex put the tools and base instructions inside the input array rather than in the top-level instructions and tools fields. Permissions, skill metadata, environment context and request framing made up the remainder.

For scale, a similar capture in July put Claude Code at around 33k tokens before the prompt and OpenCode at roughly 7k. Those figures came from the usage blocks the API returned. The Codex figures come from a local tokenizer, so the two sets are not measured the same way.

Instructions, skills and MCP tools

Project instructions are sent in full, and the directory you launch from decides which ones. Codex builds its instruction chain from the repository root down to the launch directory, picks up an AGENTS.md at each level and places the closer files later. With one root file and one child file of 100 unique markers each, starting at the root sent the 100 root markers and none from the child. Starting in the child directory sent all 200. Starting at the root and then running ls child added nothing. Reading the child file explicitly could still bring its contents in, but as ordinary tool history.

The size test used synthetic, high-entropy markers such as PAIRED_AGENTS_1000_0001. o200k_base splits each one into 11 tokens, far more than an ordinary word costs. So the figures show that instructions travel in full, not what a real AGENTS.md would cost. With 250 markers the first request grew by 5,947 bytes and about 2,530 tokens. With 1,000 markers it grew by 24,197 bytes and about 11,030 tokens, to 20,465 tokens in total. In a two-request trace with 250 markers, all 250 showed up in both requests.

Skills load in two stages. A repository skill under .agents/skills/ first contributes only its name, description and path, and the SKILL.md body stays out until it is read. Each test skill had a 12-word description and a 200-word body. One skill added 481 bytes and about 125 tokens to the first request. Ten skills added 4,810 bytes and about 1,250 tokens. None of the body markers appeared in either first request.

MCP servers, which plug external tools into the agent, work the same way. With one local server exposing three tools, and with two servers exposing seven, the initial requests were both 46,582 bytes and about 10,410 tokens. Neither contained the custom tool names or descriptions. Instead, the exec interface gained generic guidance on discovering MCP tools, and disabling the server brought the request back to the baseline. The descriptions only arrived once exec printed the matching deferred entries, and from then on they sat in the history:

  • one server, three tools: 120 markers kept, 5,894 bytes and about 1,522 tokens added;
  • two servers, seven tools: 360 markers kept, 15,970 bytes and about 4,210 tokens added;
  • one server allowlisted to a single tool: 40 markers kept, 2,288 bytes and about 578 tokens added.

Truncation sets a ceiling on this, but not a low one. A single tool description with 5,000 markers was cut to a head-and-tail sample that still held 1,046 markers, and the next request grew by 40,607 bytes and about 9,631 tokens.

What a bug fix piles up

To see how a working session grows, the author built a small Python fixture with a configuration bug, where an explicit false was being overwritten by a user default, and gave Codex this task: fix the precedence bug, add a regression test and run the relevant suite. The fake responses scripted every step in advance, so the trace measures how the request grows, not how the model reasons. Over nine actions (search, file reads, initial tests, adding the regression, the failing test, a second inspection, the fix, the passing suite, the diff check) the request went from 44,189 bytes and about 9,815 tokens to 52,389 bytes and about 11,889 tokens. Every search result, file, test run, failure, patch and the final diff stayed available to later turns.

Files only cross the boundary once something reads them. The author planted five harmless files with unique markers: a normal source file, a gitignored file, a fake .env, a gitignored 20,000-line log and a file named inside AGENTS.md. None of their contents were in the first request, and rg --files -uu added only filenames. Once read explicitly, each of the four that were tested appeared in later requests. Codex did not upload the repository on its own, but .gitignore did not block explicit reads either, so an ignored file is kept out only until something reads it. The log read was the expensive step. It was truncated to a head-and-tail sample, yet it still added about 9,900 tokens, going from 10,418 to 20,350, which is about the size of the whole baseline request.

Terminal output behaves the same way. Ten-line and hundred-line results carried over verbatim into the following requests. A 10,000-line result was cut to a head-and-tail sample, and the request still grew from 43,337 bytes and about 9,584 tokens to 88,480 bytes and 25,835 tokens, an increase of about 16,250 tokens from one command. Repeated output was not deduplicated, and ANSI-formatted text and a failing Python stack trace stayed in the history too.

Images go out as base64 data URLs. A synthetic 32×32 PNG became a 442-character data:image/png;base64,… URL. A larger gradient PNG was resized and re-encoded before sending, and its 71,666-character data URL decoded to a 1600×1600 PNG. The raw bodies were 43,955 bytes with the small image, 115,265 with the resized large one and 115,886 with both. The author did not estimate cost here, because running a text tokenizer over base64 tells you nothing about how images are counted.

When the history gets rewritten

Compaction is how Codex keeps a long session inside the context window: it sends the accumulated history through another model request, swaps it for a summary and carries on. Against OpenAI or Azure it uses a dedicated endpoint. Against a custom provider such as the recorder, Codex builds the summary request itself, and that is the path that was captured.

The author triggered it with synthetic usage figures: 13,000 reported input tokens, a 20,000-token context window and a 12,000-token compaction threshold. That produced three requests:

  • the initial request, 42,030 bytes and about 9,378 tokens, with the normal tools and the user’s request;
  • the compaction request, 68,375 bytes and about 21,408 tokens, carrying the history, a large retained tool result and a summary prompt, with the normal tool list empty;
  • the resumed request, 42,646 bytes and about 9,500 tokens, with the tools and the original user message back and the raw tool call and output replaced by the summary.

The resumed request was 25,729 bytes and about 11,908 tokens smaller than the compaction request. The summary was kept deliberately short, so the trace shows how the history gets replaced, not how well a real model would summarize it. After compaction, a detail from a file or a command may survive only through the generated summary.

The traces also undercount a live session. The fixed fake responses carried no model reasoning, so real sessions add more per turn than these figures show. The numbers are also tied to one release. Version 0.159.1, which shipped later, on September 29, made GPT-6.1 Sol the default model, and the author does not claim a minimum request that holds across Codex versions, models, operating systems or product surfaces. A companion artifact pack includes the recorder, the sanitized request bodies, the analysis files, tests and figure sources.

Some material is in the request before any tool runs: Codex’s instructions, the visible tool interfaces, the discovered AGENTS.md chain, skill metadata, environment context and the prompt. File contents, terminal output, MCP descriptions and images only appear after an action brings them in. As the author puts it: “The prompt was the seed. The request was the working state.”

No comments yet. Be the first.

Join the conversation

Sign in to leave a comment. It appears after moderation.