model not found: bad model id
Last verified:
The fix
model not found means this API key cannot call that id. The model does not exist or you do not have access to it. Copy an id from the provider's list.
- 1
Read the code and the id
If the body contains
model_not_foundor “does not exist or you do not have access,” the string inmodelis the problem. Copy it out of the request. Do not treat it as a network error and retry. - 2
Replace it with an id this key can call
In the provider’s dashboard, copy a model id from the list for this account and project. Put that id in the server env, for example
OPENAI_MODEL, and read it in the route. Do not guess the next version number. Do not ship the API key to the browser while you are changing the id. - 3
Separate the app from the coding tool
If the words appear in Cursor, Lovable, Bolt, or another builder’s model picker, pick a model that tool still lists and start a new message. That does not update
model:inside your repository. If both are broken, fix the one whose screen you are looking at. - 4
Do not hide it with a fallback loop
Catching
model_not_foundand trying three other guessed ids spends the key and still fails. One id, one request. If the account has no access, say so in the UI. A 429 insufficient-quota body is the quota page, not this one.
Why it happens
OpenAI returns model_not_found when the message says the model does not exist or you do not have access to it. The id in that message is the string your request sent. The key itself authenticated. A billing or rate-limit failure is HTTP 429 and a different page.
Generated apps hardcode a name the chat invented, a dated snapshot, or a model from a blog post. The coding tool’s own picker can also say the model is gone because that product removed it. Changing the picker does not fix a string baked into your server route, and inventing a new id in the route does not fix the picker.
The next error you'll probably hit
Once this is fixed, the usual follow-up is You exceeded your current quota. You exceeded your current quota: the OpenAI account has no credit. Add billing. Retrying will not help. Rate limit reached is the other 429.
Prompt to paste back into your AI tool
Paste this above the error.
The API returned model not found. The error body is: <paste the JSON, including the model id and the code> Do not retry in a loop. Do not invent a replacement model id. Do not put the API key in NEXT_PUBLIC_ or VITE_. Do not switch this to a 429 handler. 1. If the code is model_not_found, or the message says the model does not exist or you do not have access, show me the exact model string the code sends. 2. Read it from an env var such as OPENAI_MODEL. Tell me to set that var to an id copied from this account's model list. Do not hardcode a guessed name. 3. If this message is only in the coding tool's model picker, say so and do not edit the app. 4. Change only the request that sets model.
Common questions
+The same key works in the playground. Why does the app say model not found?
The playground is calling a model id your code is not. Log the model string the app sends, not the key, and compare it to the playground’s model. A different project on the same account can also lack access to that id.
+Is model not found the same as a 429?
No. model_not_found means the id is wrong or not enabled. A 429 is a rate limit or an empty quota. Retrying, or adding a card, does not make a bad id exist.
+The model does not exist or you do not have access to it. What do I change?
That sentence is model_not_found. The id in the message is the string your request sent. Copy an id from this account's model list into the server env. Do not guess the next version number.
+Cursor says model not found. Is that the API?
Not always. The tool's model picker and the model string in your route are separate. Pick a model the tool still lists, and set the route from the provider's list. Changing one does not change the other.
Related errors
- You exceeded your current quotaYou exceeded your current quota: the OpenAI account has no credit. Add billing. Retrying will not help. Rate limit reached is the other 429.CursorLovableBoltOpenAINext.jsOct 14, 2026
- NEXT_PUBLIC_ secret in the bundleA NEXT_PUBLIC_ or VITE_ secret is in the browser bundle. Rotate the key, move the call to a server route, and keep real public keys in the client.CursorLovableBoltNext.jsViteNov 11, 2026