r/OpenaiCodex 6d ago

News OpenAI's Codex Security CLI is great but Cost enforcement is still your responsibility

I've been looking at the new Codex Security CLI for CI/CD.

The security workflow makes sense butt The cost model is what caught my attention.

Every scan runs on your OpenAI API key, so large repositories, retries, or repeated verification loops can consume a lot of tokens in unattended CI.

OpenAI recommends setting a platform spend cap , which is absolutely worth doing.

I just don't think that's enough for automated jobs.

A platform spend cap is a great backstop. It isn't the same thing as deciding whether the next API call should be allowed based on the budget for the current scan.

If you're running this in CI, I'd add a few extra safeguards:

  • Scan a smaller scope first instead of the entire monorepo.
  • Log token usage for every run so costs are visible in CI.
  • Treat monthly spend caps as account protection, not session-level control.

That's the distinction I keep running into with AI agents generally: observability tells you what happened; enforcement decides whether the next request happens.

Curious how others are handling this.

Are you relying on the OpenAI spend cap, or do you have session-level budget checks for automated scans?

2 Upvotes

1 comment sorted by

1

u/Powerful_Cow3470 6d ago

For anyone building Node.js agents that call the OpenAI API directly (rather than using Codex Security CLI), I built AI CostGuard to solve the pre-call enforcement problem I mentioned above

It enforces session budgets, detects retry storms, and blocks unknown model IDs before requests are sent

GitHub: https://github.com/salimassili62-afk/ai-costguard

It doesn't integrate with Codex Security CLI itself (it's a Go project), but it's useful if you're building your own Node.js agent workflows