cd /news/ai-tools/codex-cost-per-project-how-to-measur… · home › topics › ai-tools › article
[ARTICLE · art-166468] src=usageatlas.com ↗ pub= topic=ai-tools verified=true sentiment=· neutral

Codex cost per project: how to measure it

Codex session files record each session's working directory, so per-project cost can be calculated by grouping sessions by that path and multiplying input, cached input, output and reasoning tokens by their respective API rates, according to a UsageAtlas guide. The guide warns that directory attribution is imperfect — a session that starts in one repository and edits another still belongs to the first — and that on a subscription the marginal cost is zero until a limit is hit, so API rates serve only as a shadow price. It recommends normalizing cost by merged pull requests or shipped features rather than hours, tracking a project for a full week before ranking it, and recording the model used, since a model switch can double a line without any behavior change.

read3 min views27 publishedNov 7, 2026
Codex cost per project: how to measure it
Image: Usageatlas (auto-discovered)

Quick answer #

Codex session files record the working directory, so cost per project is a two-step calculation: total tokens for that directory, then multiply by the rate for each token type. On a subscription the marginal cost is zero until you hit a limit, so value the tokens at API rates if you want a comparable number.

Attribute sessions to a project #

  1. Open the session file and read the recorded working directory.
  2. Group sessions by that path, not by the repository name; monorepos and worktrees share a name.
  3. Total input, cached input, output, and reasoning separately.
  4. Exclude sessions that only read a file from the project while working elsewhere.

Directory attribution is imperfect. A session that starts in one repo and edits another still belongs to the first. Note that when a project looks unusually expensive.

Convert tokens to money #

cost = input_tokens * input_rate
     + cached_tokens * cached_rate
     + output_tokens * output_rate
Token type Why it has its own rate Common mistake
Input Fresh context sent to the model Using output rate for everything
Cached input Discounted reuse of a stable prefix Counting it as full input
Output Generated text Forgetting reasoning tokens
Reasoning Billed with output, often shown apart Double counting

Read the rates from the provider's current pricing page. Do not hard-code a rate you saw in a comparison post.

Compare projects fairly #

  • Normalise by merged pull requests or shipped features, not by hours.
  • Separate exploration from implementation on the first pass.
  • Track the same project for a full week before ranking it.
  • Record the model used; a model switch can double a line without any behaviour change.

UsageAtlas keeps the directory and model fields together, which is enough to produce this table without a spreadsheet.

Attribute sessions before you divide #

Per-project cost only works if each session is attributed to one repository. Codex records the working directory per session, so the attribution is available; the mistake is dividing a monthly total by the number of projects you touched.

  • Group sessions by working directory.
  • Exclude sessions with no completed work.
  • Keep shared setup work in its own bucket.
  • Separate model cost from plan cost.

UsageAtlas groups local sessions by project and shows the 30 or 90-day total, which is the number to divide. The formula is in AI coding cost per project.

Questions, answered #

Does Codex store the project name?

It stores the working directory. The project name is derived from that path, and a monorepo will collapse several projects into one.

Is cost per project meaningful on a subscription?

Only as a shadow price. You do not pay per token until you exceed the allowance, but valuing usage at API rates shows which projects would be expensive if you did.

Should I include cached tokens in project cost?

Yes, at the cached rate. They are still billed, just cheaper, and ignoring them understates the total.

── more in #ai-tools 4 stories · sorted by recency
── more on @codex 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/codex-cost-per-proje…] indexed:0 read:3min 2026-11-07 · —