Live data from Hacker News

OpenAI Codex CLI: Lightweight coding agent that runs in your terminal

github.com

191–200 of 298 posts

Re: OpenAI Codex CLI: Lightweight coding agent that runs in your terminal

#191
post #150
post #13

Next, set your OpenAI API key as an environment variable: export OPENAI_API_KEY="your-api-key-here" Note: This command sets the key only for your current terminal session. To make it permanent, add the export line to your shell's configuration file (e.g., ~/.zshrc). Can't any 3rd party utility running in the same shell session phone home with the API key? I'd ideally want only codex to be able to access this var

Just don't export it? OPENAI_API_KEY="your-api-key-here" codex

Yea that’s not gonna work, you have to export it for it to become part of your shell’s environment and be passed down to subprocesses.

You could however wrap the export variable and codex command in a script and just call that. This way the variable would only be part of that script’s environment.

Re: OpenAI Codex CLI: Lightweight coding agent that runs in your terminal

#193
post #159
post #143

These days, I usually paste my entire (or some) repo into gemini and then APPLY changes back into my code using this handy script i wrote: https://github.com/asadm/vibemode I have tried aider/copilot/continue/etc. But they lack in one way or the other.

It’s not just about saving money or making less mistakes its also about iteration speed. I can’t believe this process is remotely comparable to aider. In aider everything is loaded in memory I can add drop files in terminal, discuss in terminal, switch models, every change is a commit, run terminal commands with ! at the start. Full codebase is more expensive and slower than relevant files. I understand when you don’…

Use a tool like repomix (npm), which has extensions in some editors (at least VSCode) that can quickly bundle source files into a machine readable format

Re: OpenAI Codex CLI: Lightweight coding agent that runs in your terminal

#195
post #74

I tried one task head-to-head with Codex o4-mini vs Claude Code: writing documentation for a tricky area of a medium-sized codebase. Claude Code did great and wrote pretty decent docs. Codex didn't do well. It hallucinated a bunch of stuff that wasn't in the code, and completely misrepresented the architecture - it started talking about server backends and REST APIs in an app that doesn't have any of that. I'm curiou…

Claude Code still feels superior. o4-mini has all sorts of issues. o3 is better but at that point, you aren't saving money so who cares. I feel like people are sleeping on Claude Code for one reason or another. Its not cheap, but its by far the best, most consistent experience I have had.

Claude Code is just way too expensive.

These days I’m using Amazon Q Pro on the CLI. Very similar experience to Claude Code minus a few batteries. But it’s capped at $20/mo and won’t set my credit card on fire.

Re: OpenAI Codex CLI: Lightweight coding agent that runs in your terminal

#196
Claude Code represents something far more than a coding capability to me. It can do anything a human can do within a terminal.

It’s exceptionally good at coding. Amazing software, really, I’m sure the cost hurdles will be resolved. Yet still often worth the spend

Re: OpenAI Codex CLI: Lightweight coding agent that runs in your terminal

#197

Here is the prompt template, in case you're interested: const prefix = `You are operating as and within the Codex CLI, a terminal-based agentic coding assistant built by OpenAI. It wraps OpenAI models to enable natural language interaction with a local codebase. You are expected to be precise, safe, and helpful. You can: - Receive user prompts, project context, and files. - Stream responses and emit function calls (e…

> built by OpenAI many moons ago

What’s with this writing style in a prompt? Is there a reason they write like that? Or does it just not matter so why not?

Re: OpenAI Codex CLI: Lightweight coding agent that runs in your terminal

#198
post #165

Earlier quoted context omitted.

Claude Code still feels superior. o4-mini has all sorts of issues. o3 is better but at that point, you aren't saving money so who cares. I feel like people are sleeping on Claude Code for one reason or another. Its not cheap, but its by far the best, most consistent experience I have had.

> Its not cheap, but its by far the best, most consistent experience I have had. It’s too expensive for what it does though. And it starts failing rapidly when it exhausts the context window.

I keep seeing this sentiment and it's wild to me.

Sure, it might cost a few dollars here and there. But what I've personally been getting from it, for that cost, is so far away from "expensive" it's laughable.

Not only does it do things I don't want to do, in a _super_ efficient manner. It does things I don't know how to do - contextually, within my own project, such that when it's done I _do_ know how to do it.

Like others have said - if you're exhausting the context window, the problem is you, not the tool.

Example, I have a project where I've been particularly lazy and there's a handful of models that are _huge_. I know better than to have Claude read those models into context - that would be stupid. Rather - I tell it specifically what I want to do within those models, give it specific method names and tell it not to read the whole file, rather search for and read the area around the method definition.

If you _do_ need it to work with very large files - they probably shouldn't be that large and you're likely better off refactoring those files (with Claude, of course) to abstract out where you can and reduce the line count. Or, if anything, literally just temporarily remove a bunch of code from the huge files that isn't relevant to the task so that when it reads it it doesn't have to pull all of that into context. (ie: Copy/paste the file into a backup location, delete a bunch of unrelated stuff in the working file, do your work with claude then 'merge' the changes to the backup file and copy it back)

If a few dollars here and there for getting tasks done is "too expensive" you're using it wrong. The amount of time I'm saving for those dollars is worth many times the cost and the number of times that I've gotten unsatisfactory results from that spending has been less than 5.

I see the same replies to these same complaints everywhere - people complaining about how it's too expensive or becomes useless with a full context. Those replies all state the same thing - if you're filling the context, you've already screwed it up. (And also, that's why it's so expensive)

I'll agree with sibling commenters - have claude build documentation within the project as you go. Try to keep tasks silo'd - get in, get the thing done, document it and get out. Start a new task. (This is dependent on context - if you have to load up the context to get the task done, you're incentivized to keep going rather than dump and reload with a new task/session, thus paying the context tax again - but you also are going to get less great results... so, lesson here... minimize context.)

100% of the time that I've gotten bad results/gone in circles/gotten hallucinations was when I loaded up the context or got lazy and didn't want to start new sessions after finishing a task and just kept moving into new tasks. If I even _see_ that little indicator on the bottom right about how much context is available before auto-compact I know I'm getting less-good functionality and I need to be careful about what I even trust it's saying.

It's not going to build your entire app in a single session/context window. Cut down your tasks into smaller pieces, be concise.

It's a skill problem. Not the tool.

Re: OpenAI Codex CLI: Lightweight coding agent that runs in your terminal

#199
post #196

Claude Code represents something far more than a coding capability to me. It can do anything a human can do within a terminal. It’s exceptionally good at coding. Amazing software, really, I’m sure the cost hurdles will be resolved. Yet still often worth the spend

> It can do anything a human can do within a terminal.

This.. isn't true.

Re: OpenAI Codex CLI: Lightweight coding agent that runs in your terminal

#200

Earlier quoted context omitted.

I've ended up with $5K+ in a month using sonnet 3.7, had to dial it back. I'm much happier with gemini 2.5 pro right now for high performance at a much more reasonable cost (primarily using with RA.Aid, but I've tried it with Windsurf, cline, and roo.)

Hoooly hell. I swear the AI coding products are basically slot machines.

Or the people using them are literally clueless.
Post reply on HN