back to homepage

I've learned about the true cost of using Codex and how much it costs to scaffold an app

OpenAI just released a public version of Codex, a tool mainly intended for developers that you can use in the CLI. It exposes ChatGPT functionality and reasoning to your CLI with the capability to manipulate, create, run files and code.

I took it out for a run using a the T3 Stack and scaffolded an app idea I had. I was able to do a week's worth of work in just a couple hours. It can be a fairly expensive considering the number tokens it uses.

Currently the app includes the following:

  • Authentication (although it comes more or less out of the box using NextAuth.js), including the complete auth flow using Google and E-mail magic links.
  • Server, routing, endpoints, database handling, mockdata seeding and models
  • Basic UI including all the relevant views and components, all the relevant user flows.
  • Payment handling using the Mollie API, including the relevant webhooks and functionalities.
  • Functionality for storing third-party data, including webhooks that I can connect to a cronjob.
  • And a bunch of other product-specific functionalities

All in all, this took me a couple hours using Codex and it used up 10,661,942 tokens and 258 requests using the o4-mini model. At the end of it my cost was $0,58. However, the reality is that I obviously got a bunch of tokens for free.

Looking at this chart we can see that:

  • Input tokens cost: $0.365
  • Cached input tokens cost: $0.128
  • Output tokens cost: $0.083
  • Total cost: $0.576 ≈ $0.58

Taking the current pricing for o4-mini

We can assume:

  1. Input tokens
    $0.365 at $1.10/M →
    $0.365 ÷ $1.10 × 1,000,000 ≈ 331,818 tokens
  2. Cached input tokens
    $0.128 at $0.275/M →
    $0.128 ÷ $0.275 × 1,000,000 ≈ 465,455 tokens
  3. Output tokens
    $0.083 at $4.40/M →
    $0.083 ÷ $4.40 × 1,000,000 ≈ 18,864 tokens

That means:
Total = 331,818 + 465,455 + 18,864 ≈ 816,137 tokens

But in reality I used 10,661,942 tokens.

If I were to do this without any free credit and all 10,661,942 tokens were charged at average split rates, a rough estimate would be:

  • 40% input
  • 50% cached input
  • 10% output (reasonable for chat use)
TypeTokensPrice per 1MEstimated Cost
Input~4.26M$1.10$4.69
Cached Input~5.33M$0.275$1.47
Output~1.07M$4.40$4.71
Total~10.66M~$10.87
  • I used: 10.66 million tokens
  • I paid: $0.58
  • Without free credits, I would’ve paid ~$10.87

So essentially 11 bucks to just scaffold an app idea. In theory, the app is "feature complete" in its current state and I can deploy it live for use. However, there's still plenty of work that still needs to be done.

Would I use it again? Definitely! I think 11 bucks to scaffold an app idea is definitely worth it, especially if you lack the time. It's given me a huge head start and given me a basis to work on and polish. Not sure if I would use it in a similar style for existing (or bigger) codebases considering the costs. It really helps taking over the majority of the plumbing work leaving you with all the engineering work, which is obviously more fun to work on.

I wouldn't say it's at a point that it can 100% completely take over the work back-to-front, so there's still a lot of work that you have to do manually (or semi-manually if you're using an IDE like Cursor), but we are definitely heading to that.

Keep reading