Skip to content
Takes about 2 minutes

Connect Codex CLI to PromptUnit

Codex doesn't have a settings screen for this, so it's two lines typed into a terminal instead of clicking a toggle. Still copy-paste, no real coding involved.

1

Get your PromptUnit key

If you haven't already, sign up free at PromptUnit (no credit card). Once you're in, go to your Dashboard and open API Keys. Copy the key shown there, you'll need it in a moment.

2

Open a terminal

The same one you'd normally use to run Codex.

3

Type two lines, then press enter after each

On Mac or Linux, paste these one at a time (replace your_key_here with the key from Step 1):

Line 1

export OPENAI_BASE_URL="https://www.promptunit.ai/api/proxy/openai"

Line 2

export OPENAI_API_KEY="your_key_here"

On Windows, use these instead (in PowerShell):

Line 1

$env:OPENAI_BASE_URL="https://www.promptunit.ai/api/proxy/openai"

Line 2

$env:OPENAI_API_KEY="your_key_here"
4

Run Codex as usual, in that same terminal window

As long as you don't close that terminal window, Codex will keep using PromptUnit. If you close it and open a new one, you'd need to run those two lines again, unless you make it permanent (next step).

5

Optional: make it permanent

If you don't want to retype those lines every time, add the same two export lines (Mac/Linux) to a file called ~/.zshrc or ~/.bashrc in your home folder, then restart your terminal. This step is genuinely optional, everything already works without it.

6

Watch your savings

Open your PromptUnit Dashboard any time to see exactly how much you've saved, request by request. If you signed up through the free trial, your first $5 in real savings costs nothing, no card needed.

If something doesn't look right

Make sure there are no typos in the two lines, especially the quotation marks. If you closed your terminal and things stopped working, that's expected unless you did the optional permanent step, just run the two lines again. Still stuck? Reach out and we'll sort it out with you directly.

Quick reference

The address you'll paste in, if you need it again:

https://www.promptunit.ai/api/proxy/openai