fix(api): normalize openai_compatible provider name in models endpoint (fixes #792)#801
Merged
lfnovo merged 1 commit intoMay 29, 2026
Conversation
The /api/models/providers endpoint was exposing the OpenAI-compatible
provider under the hyphen form ("openai-compatible") while the rest of
the codebase - allow-list, credentials service, dispatch, test, and
discover branches - consistently uses the underscore form
("openai_compatible"). Frontend (api-keys/page.tsx) also uses the
underscore form throughout.
The mismatch meant credentials created against this provider could not
be tested or used: every code path that dispatched by provider rejected
them with "Unknown provider: openai-compatible".
Fixed by aligning provider_status and the special-case dispatch to the
underscore form. Esperanto itself exposes the provider with a hyphen, so
the only spot that still references the hyphen form is at the Esperanto
boundary, with a comment explaining why.
Tests in test_models_api.py were asserting the buggy hyphen form on the
API response; updated assertions to match the underscore form. Mocked
Esperanto returns keep the hyphen since that's what real Esperanto
returns.
Fixes lfnovo#792
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #792 — credentials created for the
openai-compatibleprovider could not be tested or used because the provider name was spelled with a hyphen inapi/routers/models.pybut with an underscore everywhere else (allow-list,credentials_service.py, dispatch / test / discover branches, the frontendapi-keys/page.tsx).This PR aligns the two locations in
api/routers/models.pyto the underscore form (openai_compatible) used by the rest of the codebase.Changes
api/routers/models.pyL417:provider_status["openai-compatible"]→provider_status["openai_compatible"]api/routers/models.pyL445:if provider == "openai-compatible":→if provider == "openai_compatible":AIFactory.get_available_providers()(confirmed againstesperanto==2.21.0). Added a singleesperanto_name = "openai-compatible"local at the Esperanto-boundary inside the special-case branch, with a comment, so the lookup againstesperanto_available[model_type]still succeeds.tests/test_models_api.py: updated assertions on the API response payload to expect the underscore form. Mockedesperanto_availablevalues keep the hyphen form (that's what real Esperanto returns).Test plan
tests/test_models_api.py::TestModelsProviderAvailabilitypass."openai-compatible"(hyphen) in modality lists, so the normalization at the boundary is needed.🤖 Generated with Claude Code