There doesn’t appear to be a systemic issue with the keys (low 401 rate and I can successfully follow your steps)
Evidence points to your API key being rejected. The thing to focus on here is the cURL request, since that eliminates anything weird Codex could be doing
You will get a 401 if that $V0_API_KEY variable is undefined, in case your export V0_API_KEY command executed in a different environment and the variable didn’t carry over to when you ran your curl command, so make sure you test them back to back
Thanks again for following up — I finally managed to get the Vercel key itself working, but I’ve run into a second, CLI-specific problem that’s preventing me from switching my default provider back to OpenAI.
Where things stand now
Step
Result
1. curl with V0_API_KEY
returns 200 (v0-1.5-md) — so the key & billing are good.
2. codex --provider vercel … after codex auth login vercel
works (no more 401).
3. codex config set provider openaifrom the shell
CLI prints its banner, drops into the interactive REPL, then ignores the config command.
4. `codex config show
head`
same banner → REPL → unhandled EPIPE (Node v22.16.0).
5. codex config path
prints the expected path (/home/loai1/.codex/config.yaml).
Manually editing ~/.codex/config.yamldoes change the default to OpenAI, but any attempt to use codex config … results in the REPL + EPIPE crash above, so I can’t rely on the built-in config commands.
Environment
WSL (Ubuntu 22.04) on Windows 10
Node 22.16.0
Codex CLI v0.1.2505172129 (installed via npm -g)
Repro
codex auth logout vercel
codex auth login vercel # paste Vercel v1: key
codex config set provider openai # ← drops to REPL instead of writing config
I couldn’t get it to work too. I followed the v0 docs and have the provider vercel added in config.json , and then I have V0_API_KEY in env along side OPENAI_API_KEY (which seems to be the cause of the issue)
curl with V0_API_KEY returns 200 as well
I think it is an upstream issue reported in the codex repo:
and the issue seems to be related to being logged in with openai keys and then trying to switch to other providers.