GPT 4.1 in chat completion API throws `unknown mode` error

When I am trying to access the chat completion API with the model gpt-4.1 I get the following error

Error getting code analysis: Unknown model 'gpt-4.1'. Please provide a valid OpenAI model name in: o1, o1-2024-12-17, o1-pro, o1-pro-2025-03-19, o1-preview, o1-preview-2024-09-12, o1-mini, o1-mini-2024-09-12, o3-mini, o3-mini-2025-01-31, gpt-4, gpt-4-32k, gpt-4-1106-preview, gpt-4-0125-preview, gpt-4-turbo-preview, gpt-4-vision-preview, gpt-4-1106-vision-preview, gpt-4-turbo-2024-04-09, gpt-4-turbo, gpt-4o, gpt-4o-audio-preview, gpt-4o-audio-preview-2024-12-17, gpt-4o-audio-preview-2024-10-01, gpt-4o-mini-audio-preview, gpt-4o-mini-audio-preview-2024-12-17, gpt-4o-2024-05-13, gpt-4o-2024-08-06, gpt-4o-2024-11-20, gpt-4.5-preview, gpt-4.5-preview-2025-02-27, chatgpt-4o-latest, gpt-4o-mini, gpt-4o-mini-2024-07-18, gpt-4-0613, gpt-4-32k-0613, gpt-4-0314, gpt-4-32k-0314, gpt-3.5-turbo, gpt-3.5-turbo-16k, gpt-3.5-turbo-0125, gpt-3.5-turbo-1106, gpt-3.5-turbo-0613, gpt-3.5-turbo-16k-0613, gpt-3.5-turbo-0301, text-davinci-003, text-davinci-002, gpt-3.5-turbo-instruct, text-ada-001, text-babbage-001, text-curie-001, ada, babbage, curie, davinci, gpt-35-turbo-16k, gpt-35-turbo, gpt-35-turbo-0125, gpt-35-turbo-1106, gpt-35-turbo-0613, gpt-35-turbo-16k-0613

My total usage is almost a dollar now. Is that what is stopping me from access? I did upgrade to tier 2 just to be sure, and I do see 4.1 is he list, but the API still responds with the error, and does not even show 4.1 in the list.

What is going wrong?

It would appear that you are using somebody’s software that is blocking the request because it has an obsolete list of models.

The actual API returns for an unknown model:

<Response [404 Not Found]> b'{\n "error": {\n "message": "The model gpt-4.2 does not exist or you do not have access to it.",\n "type": "invalid_request_error",\n "param": null,\n "code": "model_not_found"\n }\n}\n'

You were right.
This error was generating from a llama index package.
Thanks for the tip.

1 Like