OpenAI's newest official command-line tool, the OpenAI CLI, can't edit a single line of your code, by design. If you searched "openai cli vs codex cli" because you typed openai expecting a coding agent and got a list of API resources instead, you weren't the only one. The Hacker News thread (235 points, 111 comments) spent a lot of its length on exactly that confusion.
The short version, from the openai-cli README itself: use openai for specific API calls and scripted API operations, and use codex when you want an agent that edits code. One HN commenter, imdsm, compressed it further: "Codex = agent harness", "OpenAI CLI = wrapper around API."
I went through the README, the docs and the pricing pages for all three tools. My take: the OpenAI CLI is the most boring of the bunch, and for shell scripts that makes it the most useful one. I'll put install commands, auth, pricing and scripting flags side by side, and then get to the model choice in the README that will cost you at least 50x more than it needs to.
What the OpenAI CLI actually is
It's a Go binary (Go 1.26+ if you build it yourself), Apache 2.0, that maps the REST API onto commands shaped like openai <resource> [subresource...] <command> [flags...]. At the time of writing the repo sits at about 1.1k stars and 575 commits, and the latest release is v1.40.5, tagged on October 23, 2026.
What it covers, per the README: Responses, images, files, batches, models, audio/speech, local token counting, webhook testing, and admin endpoints like org usage reports. What it doesn't cover: reading your repo, running your tests, or opening a diff. There's no agent loop at all. You send a request and get a response back.
brew install openai/tools/openai
# or
go install 'github.com/openai/openai-cli/cmd/openai@latest'
openai help setup # stores your API key
openai responses create --model gpt-5.5 --input "Say this is a test"
OpenAI CLI vs Codex CLI vs Claude Code, side by side
| OpenAI CLI | Codex CLI | Claude Code | |
|---|---|---|---|
| What it is | REST API client | Coding agent | Coding agent |
| Install | brew install openai/tools/openai |
npm install -g @openai/codex or brew install --cask codex
|
`curl -fsSL https://claude.ai/install.sh \ |
| Auth | {% raw %}OPENAI_API_KEY (admin calls: OPENAI_ADMIN_KEY) |
ChatGPT sign-in or API key (CODEX_API_KEY in CI) |
Pro/Max/Team/Enterprise login or Console API key |
| Free tier | No (API billing only) | Free plan, GPT-6 Luna, "subject to rollout" |
No, free claude.ai plan excluded |
| Cheapest paid entry | Pay per token | ChatGPT Go, $8/mo (same models as Free); Plus at $20/mo for GPT-6.1 Sol | Claude Pro, $20/mo ($17 annual) |
| Heavy-use tier | Pay per token | Pro at $100, $200 or $500 | Max from $100/mo |
| Non-interactive mode | Every command | codex exec |
claude -p |
| Output formats | text, json, jsonl, yaml, raw | text, --json (JSONL events), --output-schema
|
text, json, stream-json, --json-schema
|
| Touches your files | Only files you upload or download | Read-only sandbox by default in exec
|
Depends on --allowedTools / permission mode |
| GitHub stars | ~1.1k | ~130.6k | n/a |
Sources: openai-cli README, Codex repo, Codex non-interactive docs, Codex pricing, Claude Code setup, Claude pricing.
The OpenAI CLI has no subscription path. HN user albert_e asked whether it eats your flat-rate quota or API credits, and since the README only documents API keys, plan on API credits. Your ChatGPT Plus plan won't cover it.
Why the dumb tool wins in shell scripts and CI
Both agents have a scripting mode now, and both are decent. codex exec sends progress to stderr and only the final message to stdout, and claude -p reads stdin, so git diff main | claude -p "..." works fine.
The catch is that a piped agent still decides how many turns to take, which tools to call, and how many tokens to burn doing it. Claude Code's own docs warn that without --bare, a -p session runs the hooks in a project's .claude/settings.json and connects the servers in its .mcp.json, "even in a folder you've never trusted." They also say --bare will become the default for -p in a future release. Codex has to tell you its exec defaults to a read-only sandbox, and that --sandbox danger-full-access belongs only in a controlled environment. Those are sensible guardrails, and they exist because the tool can act on its own.
The OpenAI CLI has nothing like that to configure. One command makes one API call:
openai models list --format jsonl | jq '.id'
openai files list --format json > files.json
openai files get file-example --transform filename --raw-output
--transform takes GJSON paths, so for simple extractions you don't even need jq. Errors go to stderr as readable summaries, and --format-error json gives you the API error details as JSON instead. JSON flags accept @path, so --input @prompt.txt keeps long prompts out of your shell history. The README even reminds you to check the exit status before trusting a redirected file, because a failed request can leave a partial one behind, which tells me whoever wrote it has been burned by a half-written JSON file before.
The batch commands are the part I'd actually use:
openai batches create --input-file-id file-example --endpoint /v1/responses --completion-window 24h
openai batches wait batch_example --output-dir ./results
Batch pricing is half of standard on the API pricing page. Neither coding agent gives you a "run this overnight at 50% off and wait for the results" command.
Isn't this just curl with extra steps?
The loudest pushback on HN came from gavinray, who put a CLI call next to the equivalent curl call and wrote: "Not sure I understand the need for maintaining a CLI." That's fair if you only ever make one kind of request.
The replies changed my mind more than the README did, though. td521534f12 pointed out that the curl example puts your API key on the command line, where it shows up in the process list. mohsen1 said "gh works so much better for me than crafting curl requests", and that's the right comparison. Nobody calls gh pointless because the GitHub API exists. Shell completion for commands and file paths, --help that works without an API key or network, and readable default output beat remembering the multipart upload format for /v1/files.
yipinwong had a different complaint: "This is not AX (agent experience) friendly (and for some humans here too)." I'd add that the README spends most of its length on how and very little on when you'd reach for this over the SDK. The naming isn't helping either. isodev's comment was "Their product names are so confusing," and I agree. Shipping something called "OpenAI CLI" next to Codex CLI pretty much guarantees threads like that one.
The cost trap: the README's example model is 50x pricier than it needs to be
Look at the README's smoke test again: --model gpt-5.5. On OpenAI's current pricing page that's $5.00 input and $30.00 output per 1M tokens. gpt-6-luna is $0.10 input and $0.50 output. For the kind of job you'd put in a cron script (classify these tickets, summarize this log, pull fields out of this text), that's 50x cheaper on input and 60x cheaper on output.
So before you copy the example into a script:
- Run
openai models listand pick the cheapest model that handles your task. - Put the key in
OPENAI_API_KEYfrom a secret manager, not in the script. - Use
--format jsonlor--transformso the next command in the pipe gets something it can parse. - Anything that doesn't need an answer right away goes through
openai batches createat half price. - Set
OPENAI_CLI_NO_UPDATE_CHECK=1on CI boxes.
The same thinking applies to Codex users. The pricing page says GPT-5.5 retired from Codex with ChatGPT sign-in on October 14, 2026, though API-key sessions still have it. If you hardcoded it somewhere, check that.
OpenAI CLI, Codex CLI or Claude Code: which one do you install?
If you want something to read your repo, run tests and send you a diff, install Codex CLI or Claude Code and pick based on whichever $20 subscription you already pay for. Both now have real headless modes with JSON output and schemas.
If you're writing a Makefile target, a cron job or a CI step that needs one model call, one image or one batch, install the OpenAI CLI. You know exactly what each command will do, and that matters a lot more in a script than an agent's cleverness does.
How many AI CLIs do you have installed right now, and which one do you actually open every day? And if you think curl plus jq makes all of this redundant, make that case in the comments.
Top comments (0)