Skip to content

[codex] Add OpenRouter to model routing#557

Merged
Th0rgal merged 3 commits into
Th0rgal:masterfrom
adrienlacombe:codex/openrouter-model-routing
Jun 17, 2026
Merged

[codex] Add OpenRouter to model routing#557
Th0rgal merged 3 commits into
Th0rgal:masterfrom
adrienlacombe:codex/openrouter-model-routing

Conversation

@adrienlacombe

Copy link
Copy Markdown
Contributor

Summary

Adds OpenRouter as a first-class provider in the Model Routing picker while keeping the existing open-router provider id used by credentials and proxy routing.

Changes

  • Adds open-router to the routing provider catalog with seeded vendor-prefixed model IDs.
  • Maps the app's open-router id to the openrouter key used by models.dev.
  • Enables live OpenRouter /v1/models discovery through the existing OpenAI-compatible catalog fetcher.
  • Requests unverified public catalog entries on the Model Routing page so OpenRouter models can populate before an account-specific fetch completes.
  • Adds an OpenRouter icon in the Add Provider modal.

Validation

  • cargo fmt --all
  • cargo fmt --all --check
  • cargo test -q openrouter --lib
  • cargo test -q api::providers::tests --lib
  • cd dashboard && bun run lint -- src/app/model-routing/page.tsx src/components/ui/add-provider-modal.tsx

@vercel

vercel Bot commented Jun 17, 2026

Copy link
Copy Markdown

@adrienlacombe is attempting to deploy a commit to the LFG Labs Team on Vercel.

A member of the Team first needs to authorize it.

@adrienlacombe adrienlacombe force-pushed the codex/openrouter-model-routing branch from db10c05 to acf31e4 Compare June 17, 2026 15:12
Addresses the review findings on PR Th0rgal#557:

- [Medium] Cap the OpenRouter catalog. fetch_openai_compatible_models had
  no upper bound and OpenRouter (empty prefix_filters) exposes a large,
  fast-growing /v1/models list, so the picker/cached catalog could be
  flooded. Adds max_models to FetchTarget and caps OpenRouter at
  MAX_CATALOG_MODELS_PER_PROVIDER (100); models are sorted by id so the
  truncation is deterministic. Other (prefix-filtered) providers stay
  uncapped.
- [Low] Bound description length. The new name/description extraction
  applies to every OpenAI-compatible provider; OpenRouter descriptions can
  run several paragraphs. truncate_description trims to
  MAX_MODEL_DESCRIPTION_CHARS (200) on char boundaries and drops empties.
- [Low] Document the deliberate page-wide includeUnverified on the routing
  page (it's a config surface; volume is bounded by the cap above).
- [Low] Seed slugs verified against OpenRouter's public catalog on
  2026-06-17 (all five exist); noted in-code that they're best-effort
  seeds superseded by the live catalog.

Adds a unit test for truncate_description (ASCII + multibyte + ellipsis).
Validated: cargo fmt --all --check; cargo test -q api::providers::tests
--lib (11 passed, 1 ignored); cargo test -q openrouter --lib (2 passed);
eslint on the changed dashboard files.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@Th0rgal Th0rgal marked this pull request as ready for review June 17, 2026 16:05
Bound the models.dev merge for open-router, fetch its public /v1/models
list without a key using ?sort=most-popular, and clarify the routing page
comment about server-side catalog limits.

Co-authored-by: Cursor <cursoragent@cursor.com>
@Th0rgal Th0rgal merged commit e7be03b into Th0rgal:master Jun 17, 2026
5 of 8 checks passed
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