Skip to content

fix(openai): return empty array on listModels API error#3

Open
MD-Mushfiqur123 wants to merge 1 commit into
masterfrom
fix-openai-error-handling
Open

fix(openai): return empty array on listModels API error#3
MD-Mushfiqur123 wants to merge 1 commit into
masterfrom
fix-openai-error-handling

Conversation

@MD-Mushfiqur123

Copy link
Copy Markdown
Owner

The OpenAI provider listModels was not checking resp.ok before parsing JSON. If the API returns an error (e.g., 401 invalid key), JSON.parse would throw on the error response body. Now returns empty array on non-2xx responses, matching the graceful fallback pattern used by other providers.

The OpenAI provider listModels was not checking resp.ok before
parsing JSON. If the API returns an error (e.g., 401 invalid key),
JSON.parse would throw on the error response body. Now returns
empty array on non-2xx responses, matching the graceful fallback
pattern used by other providers.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant