Insufficient quota if you have an organisation created because it always wants to connect to your organisation, even if you want to use the ChatGPT plus/pro subscription instead
What version of Codex is running?
0.16.0
Which model were you using?
gpt-5
What platform is your computer?
Windows
What steps can reproduce the bug?
On Windows, if you log in with the "Sign in with ChatGPT" option, and you are having an organisation on https://platform.openai.com/, it will always connect to the organisation and because of this you are receiving the error message
"⚠ Insufficient quota: You exceeded your current quota, please check your plan and billing details. For more
information on this error, read the docs: https://platform.openai.com/docs/guides/error-codes/api-errors. Manage or purchase credits at https://platform.openai.com/account/billing."
However it is not possible to delete your default organisation even if it is unused or choose to not connect with the organisation.
Because of that, it is not possible to use codex with your normal chatgpt plus subscription
On WSL, when i did the "codex login" command, where you manually post the url in your browser, it did not want to connect to the organisation at all and everything worked fine.
What is the expected behavior?
Not receiving the insufficient quota error message. Having an option to not connect to the organisation
What do you see instead?
It connects to my organisation and thus wants to use api based credits instead of my subscription
Additional information
_No response_
21 Comments
For now, please run with
OPENAI_API_KEY= codexto unsetOPENAI_API_KEYand ChatGPT login credits should be preferred.<img width="2336" height="407" alt="Image" src="https://github.com/user-attachments/assets/efe82256-6116-42be-b285-4305a81556d9" />
You need a space between
OPENAI_API_KEY=andcodex.Where do i set the "OPENAI_API_KEY= codex" ? I have the same problem like the guy who opened the issue has.
It's an env var, you can set it in any boot script. I'm running Ubutunu on WSL2 and just throw them in near the end of
~/.bashrc.It's more of a pain on Windows. You should be able to find the System Properties tool by searching for 'environment variables' in the start menu, and then you go to the Advanced tab, near the bottom is a Environment Variables button. I believe either a user or system variable would work? You don't need both, just one. And then you need to open a new command prompt.
<img width="1310" height="610" alt="Image" src="https://github.com/user-attachments/assets/bc2a51a5-647f-4c06-b155-0cb7f3439e19" />
On WSL it works fine, but not on windows. As you can see the OPENAI_API_KEY is set to be empty and i also restarted the pc, but it still gives the message.
You can do this directly from the command line. Run
OPENAI_API_KEY= codexinstead ofcodexwhich will unsetOPENAI_API_KEYspecifically for that codex invocation@gpeal I am feeling a bit stupid right now 😅
As you can see in the image, just codex works.
Running the comment like you suggested, does not work.
I asked chatgpt and it told me:
"OPENAI_API_KEY= codex is POSIX-shell syntax; cmd.exe doesn’t understand the “inline-assignment” trick.
Use a one-shot subshell instead:
cmd /C "set \"OPENAI_API_KEY=\" && codex""
This comment did work then, but didn't fix the issue at all as you can see. Still the quota error.
<img width="1903" height="994" alt="Image" src="https://github.com/user-attachments/assets/8342c96a-8b21-4825-8ae6-9f3400f95ddc" />
You can do this as two steps:
But if you do that,
OPENAI_API_KEYwill be unset for the rest of the shell session. Maybe that is fine in your case.Alternatively, if you do:
Then the
OPENAI_API_KEYenvironment variable will be empty for that single invocation ofcodex, but it does not inset it for your shell session globally.@Akrelion45 - did you manage to fix this? i have the exact same problem on v0.19.0 .
⚠ Insufficient quota: You exceeded your current quota, please check your plan and billing details. For more information on this error, read the docs: https://platform.openai.com/docs/guides/error-codes/api-errors. Manage or purchase
credits at https://platform.openai.com/account/billing.
i cannot delete the organization and Codex CLI is linking to the "personal" organization that i don't need.
@osichin No, even the newest updates to codex did not fix it. I deleted my .codex folder and updated to 0.19,
logged in again, and the error persist. Must be a really weird issue on the windows version of codex..
@Akrelion45 any chance you can run
codex login status?When I run this it starts codex then tries to send login as a chat command that gives the same error about quota.
Running v19 I have deleted auth.json and unintalled and reinstalled multiple times.
<img width="2016" height="896" alt="Image" src="https://github.com/user-attachments/assets/6fda1b65-5ac3-47de-88f9-552843d106b8" />
I get the same message as the user above if i have billing information set in my "personal" organization - but if i go into my "personal" organization and delete my billing information - i get the following. This is very clear it is trying to link to the organization instead of my personal pro subscription.
i wish i could just delete this useless "personal" organization i had previously created so that this does not happen.
----------------------------------------------------------------------------------------------------------------------------------
╭──────────────────────────────────────────────────────────────╮
│ ● OpenAI Codex (research preview) v0.19.0 │
╰──────────────────────────────────────────────────────────────╯
╭──────────────────────────────────────────────────────────────╮
│ localhost session: ---------------------------------- │
│ ↳ workdir: C:\----------------- │
│ ↳ model: codex-mini-latest │
│ ↳ provider: openai │
│ ↳ approval: suggest │
╰──────────────────────────────────────────────────────────────╯
user
login
╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│( ● ) 6s Thinking press Esc twice to interrupt │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
Ctrl+C to exit | "/" to see commands | Enter to send — 100% context left
file:///C:/Users/-------/AppData/Roaming/npm/node_modules/@openai/codex/dist/cli.js:586
,"\r"]);Qh.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function _Ve(e,t){for(let a=t??0;a<e.length;a++){if(e[a]===10)return{preceding:a,index:a+1,carriage:!1};if(e[a]===13)return{preceding:a,index:a+1,carriage:!0}}return null}function Pde(e){for(let n=0;n<e.tee().length-1;n++){if(e[n]===10&&e[n+1]===10||e[n]===13&&e[n+1]===13)return n+2;if(e[n]===13&&e[n+1]===10&&n+3<e.length&&e[n+2]===13&&e[n+3]===10)return n+4}return-1}f();function FL(e){if(e[Symbol.asyncIterator])return e;let t=e.getReader();return{
async next(){try{let r=await t.read();return r?.done&&t.releaseLock(),r}catch(r){throw t.releaseLock(),r}},async return(){let r=t.cancel();return t.releaseLock(),await r,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}var ed=clas
s e{constructor(t,r){this.iterator=t,this.controller=r}static fromSSEResponse(t,r){let n=!1;async function*a(){if(n)throw new Error("Cannot iterate over a consumed stream, use
to split the stream.");n=!0;let i=!1;try{for await(let o of.tee()AVe(t,r))if(!i){if(o.data.startsWith("[DONE]")){i=!0;continue}if(o.event===null||o.event.startsWith("response.")||o.event.startsWith("transcript.")){let s;try{s=JSON.parse(o.data)}catch(u){throw console.error("Could not parse message into JSON
:",o.data),console.error("From chunk:",o.raw),u}if(s&&s.error)throw new xi(void 0,s.error,void 0,UL(t.headers));yield s}else{let s;try{s=JSON.parse(o.data)}catch(u){throw console.error("Could not parse message into JSON:",o.data),console.error(
"From chunk:",o.raw),u}if(o.event=="error")throw new xi(void 0,s.error,s.message,void 0);yield{event:o.event,data:s}}}i=!0}catch(o){if(o instanceof Error&&o.name==="AbortError")return;throw o}finally{i||r.abort()}}return new e(a,r)}static fromR
eadableStream(t,r){let n=!1;async function*a(){let o=new Qh,s=FL(t);for await(let u of s)for(let p of o.decode(u))yield p;for(let u of o.flush())yield u}async function*i(){if(n)throw new Error("Cannot iterate over a consumed stream, use
to split the stream.");n=!0;let o=!1;try{for await(let s of a())o||s&&(yield JSON.parse(s));o=!0}catch(s){if(s instanceof Error&&s.name==="AbortError")return;throw s}finally{o||r.abort()}}return new e(i,r)}[Symbol.asyncIterator](){return this.iterator()}tee(){let t=[],r=[],n=this.iterator(),a=i=>({next:()=>{if(i.length===0){let o=n.next();t.push(o),r.push(o)}return i.shift()}});return[new e(()=>a(t),this.controller),new e(()=>a(r),this.controller)]}toReadableStream(){let t=this,r,n=new TextEncoder;return new TB({async start(){r=t[Symbol.asyncIterator]()},async pull(a){try{let{value:i,done:o}=await r.next();if(o)return a.close();let s=n.encode(JSON.stringify(i)+
e [Error]: Your account is not active, please check your billing details on our website.
at e.a [as iterator] (file:///C:/Users/------/AppData/Roaming/npm/node_modules/@openai/codex/dist/cli.js:586:1514)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async Dy.run (file:///C:/Users/-----/AppData/Roaming/npm/node_modules/@openai/codex/dist/cli.js:603:2832) {
status: undefined,
headers: undefined,
request_id: undefined,
error: {
type: 'billing_not_active',
code: 'billing_not_active',
message: 'Your account is not active, please check your billing details on our website.',
param: null
},
code: 'billing_not_active',
param: null,
type: 'billing_not_active'
}
Node.js v24.3.0
PS C:\dev\github\-------->
Oh, wait both of you are using the wrong codex (old typescript version)
can you run
npm install -g @openai/codexplease?@pakrym-oai
see below - uninstalled and re-insalled
PS C:\dev\github\------> npm uninstall -g @openai/codex
removed 221 packages in 623ms
PS C:\dev\github\-------> npm cache clean --force
npm warn using --force Recommended protections disabled.
PS C:\dev\github\-------> npm install -g @openai/codex@latest
npm warn deprecated node-domexception@1.0.0: Use your platform's native DOMException instead
added 221 packages in 6s
69 packages are looking for funding
run
npm fundfor detailsPS C:\dev\github\--------> codex login status
╭──────────────────────────────────────────────────────────────╮
│ ● OpenAI Codex (research preview) v0.19.0 │
╰──────────────────────────────────────────────────────────────╯
╭──────────────────────────────────────────────────────────────╮
│ localhost session: ---------------------│
│ ↳ workdir: C:\dev\github\-------------------│
│ ↳ model: codex-mini-latest │
│ ↳ provider: openai │
│ ↳ approval: suggest │
╰──────────────────────────────────────────────────────────────╯
user
login
╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│( ● ) 7s Thinking.. press Esc twice to interrupt │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
Ctrl+C to exit | "/" to see commands | Enter to send — 100% context left
file:///C:/Users/------/AppData/Roaming/npm/node_modules/@openai/codex/dist/cli.js:586
,"\r"]);Qh.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function _Ve(e,t){for(let a=t??0;a<e.length;a++){if(e[a]===10)return{preceding:a,index:a+1,carriage:!1};if(e[a]===13)return{preceding:a,index:a+1,carriage:!0}}return null}function Pde(e){for(let n=0;n<e.tee().length-1;n++){if(e[n]===10&&e[n+1]===10||e[n]===13&&e[n+1]===13)return n+2;if(e[n]===13&&e[n+1]===10&&n+3<e.length&&e[n+2]===13&&e[n+3]===10)return n+4}return-1}f();function FL(e){if(e[Symbol.asyncIterator])return e;let t=e.getReader();return{
async next(){try{let r=await t.read();return r?.done&&t.releaseLock(),r}catch(r){throw t.releaseLock(),r}},async return(){let r=t.cancel();return t.releaseLock(),await r,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}var ed=clas
s e{constructor(t,r){this.iterator=t,this.controller=r}static fromSSEResponse(t,r){let n=!1;async function*a(){if(n)throw new Error("Cannot iterate over a consumed stream, use
to split the stream.");n=!0;let i=!1;try{for await(let o of.tee()AVe(t,r))if(!i){if(o.data.startsWith("[DONE]")){i=!0;continue}if(o.event===null||o.event.startsWith("response.")||o.event.startsWith("transcript.")){let s;try{s=JSON.parse(o.data)}catch(u){throw console.error("Could not parse message into JSON
:",o.data),console.error("From chunk:",o.raw),u}if(s&&s.error)throw new xi(void 0,s.error,void 0,UL(t.headers));yield s}else{let s;try{s=JSON.parse(o.data)}catch(u){throw console.error("Could not parse message into JSON:",o.data),console.error(
"From chunk:",o.raw),u}if(o.event=="error")throw new xi(void 0,s.error,s.message,void 0);yield{event:o.event,data:s}}}i=!0}catch(o){if(o instanceof Error&&o.name==="AbortError")return;throw o}finally{i||r.abort()}}return new e(a,r)}static fromR
eadableStream(t,r){let n=!1;async function*a(){let o=new Qh,s=FL(t);for await(let u of s)for(let p of o.decode(u))yield p;for(let u of o.flush())yield u}async function*i(){if(n)throw new Error("Cannot iterate over a consumed stream, use
to split the stream.");n=!0;let o=!1;try{for await(let s of a())o||s&&(yield JSON.parse(s));o=!0}catch(s){if(s instanceof Error&&s.name==="AbortError")return;throw s}finally{o||r.abort()}}return new e(i,r)}[Symbol.asyncIterator](){return this.iterator()}tee(){let t=[],r=[],n=this.iterator(),a=i=>({next:()=>{if(i.length===0){let o=n.next();t.push(o),r.push(o)}return i.shift()}});return[new e(()=>a(t),this.controller),new e(()=>a(r),this.controller)]}toReadableStream(){let t=this,r,n=new TextEncoder;return new TB({async start(){r=t[Symbol.asyncIterator]()},async pull(a){try{let{value:i,done:o}=await r.next();if(o)return a.close();let s=n.encode(JSON.stringify(i)+
e [Error]: Your account is not active, please check your billing details on our website.
at e.a [as iterator] (file:///C:/Users/------/AppData/Roaming/npm/node_modules/@openai/codex/dist/cli.js:586:1514)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async Dy.run (file:///C:/Users/------/AppData/Roaming/npm/node_modules/@openai/codex/dist/cli.js:603:2832) {
status: undefined,
headers: undefined,
request_id: undefined,
error: {
type: 'billing_not_active',
code: 'billing_not_active',
message: 'Your account is not active, please check your billing details on our website.',
param: null
},
code: 'billing_not_active',
param: null,
type: 'billing_not_active'
}
Node.js v24.3.0
(octane-worker) PS C:\dev\github\------->
This is what I got as well
may others are posting the same bug @pakrym-oai
see below:
https://github.com/openai/codex/issues/2004
it's the same issue as this one.
i think there may be a fix for this in the works: https://github.com/openai/codex/pull/2019
<img width="1885" height="680" alt="Image" src="https://github.com/user-attachments/assets/3b1ab402-391c-4550-9c76-1965854d3616" />
Yep, same as the 2 other guys.
I really appreciate your reports. We are working on the fix for this.
Closing in favor of pinned https://github.com/openai/codex/issues/2000