401 Unauthorized from v0.dev API when using Codex CLI (`--provider vercel`)

Resolved 💬 3 comments Opened Jun 15, 2025 by loaishar Closed Aug 7, 2025

What version of Codex is running?

v0.1.2505172129

Which model were you using?

Codex

What platform is your computer?

_No response_

What steps can reproduce the bug?

401 Unauthorized from v0.dev API when using Codex CLI (--provider vercel)

Account / Plan

  • v0.dev account email: loai1@…
  • Plan: <Premium / Team> ← (confirm what Billing shows)
  • API key last 4 chars: ...eT3 (begins v1:)

---

| Config path | /home/<user>/.codex/config.json (see contents below) |

~/.codex/config.json

{
  "providers": {
    "vercel": {
      "name": "Vercel",
      "baseURL": "https://api.v0.dev/v1",
      "envKey": "V0_API_KEY"
    }
  }
}
````

**Session Reproduction**

```bash
export V0_API_KEY="v1:2n................................................3"
codex --provider vercel --model v0-1.0-md --verbose

CLI output

● OpenAI Codex (research preview) v0.1.2505172129
...
POST https://api.v0.dev/v1/chat/completions
→ 401 Unauthorized
⚠️  OpenAI rejected the request. Status: 401, Message: "Unauthorized"

Direct cURL test

curl -s -o /dev/null -w "%{http_code}\n" \
  -H "Authorization: Bearer $V0_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"v0-1.5-md","messages":[{"role":"user","content":"ping"}]}' \
  https://api.v0.dev/v1/chat/completions
# ⇒ 401

---

What I’ve tried

  1. Regenerated API key twice and re-exported it.
  2. Confirmed key length (53 chars incl. v1: prefix).
  3. Ensured OPENAI_API_KEY is unset to avoid provider mix-up.
  4. Placed config file inside WSL $HOME (not Windows path).
  5. Tested both v0-1.0-md and v0-1.5-md models.
  6. Verified billing page shows active usage-based billing.

Still receive 401 for every request.

---

Expected
200 OK and a valid chat completion.

Actual
401 Unauthorized with message "Unauthorized".

Please advise on any missing configuration or backend-side flag that needs to be enabled.
Happy to provide extra logs or run further diagnostics.

Thanks a lot!

What is the expected behavior?

_No response_

What do you see instead?

_No response_

Additional information

_No response_

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗