Skip to main content

OpenAI

Bad API Key.

Error Message Looks Like This

Exception: Error code: 401 - {'error': {'message': 'Incorrect API key provided: sk-3SiaI*ZZZ. You can find your API key at https://platform.openai.com/account/api-keys.', 'type': 'invalidrequesterror', 'param': None, 'code': 'invalidapi_key'}}

Reason

Old, expired, or otherwise invalid API Key. Copy-pasted the API Key from the wrong Provider?

Solution

Fix the API Key.

Bad Model Name

Error Message Looks Like This

Exception: Error code: 404 - {'error': {'message': 'The model gpt-3.5-turbo-0125XXX does not exist or you do not have access to it.', 'type': 'invalidrequesterror', 'param': None, 'code': 'modelnotfound'}}

Reason

The model name must be exactly as published by the Inference Provider.

Solution

Fix the model name.

Bad Parameter

Error Message Looks Like This

Exception: Error code: 400 - {'error': {'message': "This model's maximum context length is 16385 tokens. However, you requested 1000000000033 tokens (34 in the messages, 999999999999 in the completion). Please reduce the length of the messages or completion.", 'type': 'invalidrequesterror', 'param': 'messages', 'code': 'contextlengthexceeded'}}

Reason

The model name must be exactly as published by the Inference Provider.

Solution

Examine the parameter list. Not all providers use the same parameters, and not all models have the same parameters available.

Bad ProviderUrl

Error Message Looks Like This

Exception: Error code: 404 - {'error': {'type': 'invalidrequesterror', 'code': 'unknown_url', 'message': 'Unknown request URL: POST /v1/ZZZ/chat/completions. Please check the URL for typos, or see the docs at https://platform.openai.com/docs/api-reference/.', 'param': None}}

Reason

This should not happen if the model was configured through the UI. Were you messing with the configuration JSON file directly?

Solution

Review all settings. Delete and recreate the model.

Corrupted API Template.

Error Message Looks Like This

Inference Failure. provider: 'OpenAIXXX' not found. Most likely due to corrupted API template.

Reason

This should not happen if the model was configured through the UI. Were you messing with the configuration JSON file directly?

Solution

Delete and recreate the model. Or revert to the backup of the JSON configuration that you made before messing with it.