Skip to content

Expose external provider models through GET /v1/models - #409

Open
urucoder wants to merge 1 commit into
sybil-solutions:devfrom
urucoder:copilot/implement-external-provider-models
Open

Expose external provider models through GET /v1/models#409
urucoder wants to merge 1 commit into
sybil-solutions:devfrom
urucoder:copilot/implement-external-provider-models

Conversation

@urucoder

@urucoder urucoder commented Aug 16, 2026

Copy link
Copy Markdown

Summary

Controllers with configured external OpenAI-compatible providers only surfaced those providers' models via GET /studio/provider-models. Since models are discovered through GET /v1/models, external provider models were invisible in the model picker even when the provider was configured and reachable.

Changes

  • Shared discovery helper: extracted discoverProviderModels and enabledProvidersWithApiKey into controller/src/services/provider-routing.ts, replacing the inline providerModels function previously duplicated in provider-routes.ts.
  • /studio/provider-models: now consumes the shared helper; behavior unchanged.
  • GET /v1/models: now also queries enabled, API-key-configured providers and appends their models as qualified IDs (<provider-id>/<upstream-model-id>), alongside existing recipe/active-inference entries. Per-provider discovery failures are swallowed (Effect.option) so one unreachable provider never fails the whole endpoint, matching /studio/provider-models semantics.
  • No changes needed in the proxy (openai-routes.ts) — it already parses the qualified ID and rewrites the upstream request model correctly.

Example: with provider my-provider (base_url http://<host>:8000) enabled and reporting example-model-1, GET /v1/models now includes:

{
  "id": "my-provider/example-model-1",
  "object": "model",
  "owned_by": "my-provider",
  "active": false,
  "metadata": { "vision": false }
}

Validation

cd controller && bun run typecheck
cd controller && bun run lint
cd controller && bun run check
node scripts/project.mjs validate-contracts
node scripts/project.mjs validate-structure
node scripts/project.mjs audit-layout

Manually verified end-to-end against a live controller and a mock upstream provider server: GET /v1/models returned the qualified model ID, and a chat completion request using that ID was routed upstream with the model field rewritten back to the original provider model ID.

UI changes

None — controller-only change. Effect is a discoverability fix for the existing model picker.

Risks / rollout notes

  • Purely additive to /v1/models response; existing consumers unaffected.
  • Provider discovery adds one upstream HTTP call per enabled/configured provider per /v1/models request (10s timeout, best-effort, run concurrently) — negligible latency impact for typical provider counts.

Closes #410

Co-authored-by: urucoder <37780362+urucoder@users.noreply.github.com>
@urucoder
urucoder requested a review from 0xSero as a code owner August 16, 2026 20:19
@urucoder

Copy link
Copy Markdown
Author

Closes #410

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.

2 participants