Skip to content

✨ OpenRouter: current defaults, live-filtered suggestions, searchable grouped model picker - #18449

Merged
kubestellar-prow[bot] merged 1 commit into
v5from
feat/openrouter-defaults-picker
Nov 16, 2026
Merged

kubestellar-prow[bot] merged 1 commit into
v5from
feat/openrouter-defaults-picker

Conversation

@clubanderson

Copy link
Copy Markdown
Member

Summary

Items 1 and 3 of the gateway model-discovery work: current OpenRouter defaults, and a searchable, grouped picker for large gateway catalogs.

OpenRouter defaults (crux/openrouter)

  • DefaultModel = deepseek/deepseek-v4.1-flash (was deepseek/deepseek-chat).
  • SuggestedModels is now a short list with honest labels: DeepSeek V4.1 Flash (default, cheapest with caching), GLM-5.3 (strong, cheap), GLM-5.3 Flash (cheapest), Claude Sonnet 5.5 (premium), Gemini 3.8 Flash (fast, mid-price).
  • testdata/models.json is a trimmed recording of the live public /models catalog (id, name, context_length, pricing; 469 models, recorded 2026-11-16). TestSuggestedModelsExistInCatalogFixture fails if any suggested id or the default is missing from it. The refresh command is in the test comment.
  • Resilience: the new catalog.go adds a cached public catalog (CachedPublicModels, 15 min TTL, keeps the last good copy if a refresh fails) with pricing parsed per token. "-1" (variable) and missing prices count as unknown. The spoke (/api/openrouter/models) and hub handlers hide suggestions the live catalog no longer lists, and move the default to the first remaining suggestion if needed. If the catalog can't be read, the full curated list is served.

Discovery fix

  • fetchModelsWithHeaders and probeModelsWithHeaders always appended /v1/models. OpenRouter's stored endpoint is https://openrouter.ai/api/v1, so the request went to /api/v1/v1/models and got a 404. The OpenRouter gateway form and agent dropdowns then fell back silently to unrelated static aliases, and the spoke's funding picker never had a live list. The new openAIModelsURL mirrors how the proxy builds /chat/completions: an endpoint that ends in /v1 gets /models.

Searchable, grouped picker (static-src/js/model-picker.js)

  • An ARIA combobox (input[role=combobox] owning ul[role=listbox]). Typing filters on id and display name, with every term required. Options are grouped by provider prefix, and the curated suggestions are pinned in a "Suggested" group. Each option shows price per 1M input/output (and cached input) plus context length, or "price unknown". Keys: ArrowUp/ArrowDown, Enter, Escape. The typed text is the value, so "Custom…" (or Use "<id>" as a custom model id) is always available.
  • Used for the gateway form's Default Model when the list has 20 or more ids, or when catalog info exists, and for the OpenRouter scan-to-fund picker. Short lists keep the plain <select>.
  • Gateway discovery (/api/config/governor/gateways/discover) and /api/inference/models/{backend} return model_info and the live suggested list for OpenRouter gateways, matched by kind or by openrouter.ai host.
  • Per-agent pickers (agent card and config dialog) stay native <select>s, because other code drives them by value and auto-heal. They now group large multi-provider lists into provider <optgroup>s, and the config dialog appends the price per 1M.
  • Styling uses existing tokens only, in config-dialog.css. The new markup has no inline style=.

Tests

  • Go: catalog fixture membership, pricing parse (including cached input and unknown), suggestion filtering and default fallback, cache reuse and surviving a failed refresh, openAIModelsURL, isOpenRouterGateway, and skipping attachOpenRouterModelInfo for other kinds.
  • Node (model_picker.test.js): filtering, grouping, the custom entry, price display, ARIA markup, and optgroup grouping. The 9945 harness now injects modelOptionPriceSuffix.

🤖 Generated with Claude Code

- SuggestedModels/DefaultModel current (default deepseek/deepseek-v4.1-flash),
  pinned by a test against a recorded catalog fixture
- Retired suggestions are hidden by the spoke and hub handlers
- Fix OpenRouter model discovery: endpoints ending in /v1 probed /v1/v1/models
- Cached, priced public catalog (crux/openrouter) served as model_info
- Searchable, provider-grouped combobox for large gateway catalogs with
  price per 1M tokens and context length; per-agent selects use optgroups

Signed-off-by: Andy Anderson <andy@clubanderson.com>
@kubestellar-prow kubestellar-prow Bot added dco-signoff: yes Indicates the PR's author has signed the DCO. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Nov 16, 2026
@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Open PR overlap check

Base branch: v5

Conflicts are checked with every PR merged onto the current tip of v5, so a PR that only needs a rebase is not reported as conflicting with its siblings.

PR Title Relation Files
#18432 ✨ Inbox: auto-transcribe hive recordings same files src/pkg/dashboard/static/index.html

@clubanderson clubanderson added lgtm Indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Nov 16, 2026
@kubestellar-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

Approval requirements bypassed by manually added approval.

This pull-request has been approved by:

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@github-actions

Copy link
Copy Markdown
Contributor

Mutation testing

gremlins found 2 surviving mutant(s) in changed files: the code ran under tests, but changing it did not fail any test.

File Line Mutation
src/crux/openrouter/catalog.go 89 CONDITIONALS_BOUNDARY
src/crux/openrouter/catalog.go 167 CONDITIONALS_BOUNDARY

4 mutant(s) in changed files are not reached by any test (NOT COVERED). A maintainer may apply the mutation/acknowledged label to accept this.

File Line Mutation
src/cmd/hive/provider_gateways.go 291 CONDITIONALS_NEGATION
src/crux/openrouter/catalog.go 18 ARITHMETIC_BASE
src/crux/openrouter/catalog.go 30 ARITHMETIC_BASE
src/pkg/dashboard/gateways.go 618 CONDITIONALS_NEGATION

Verdict: lived (#17349).

@clubanderson clubanderson added approved Indicates a PR has been approved by an approver from all required OWNERS files. and removed approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Nov 16, 2026
@kubestellar-prow
kubestellar-prow Bot merged commit 214b422 into v5 Nov 16, 2026
100 of 105 checks passed
@kubestellar-prow
kubestellar-prow Bot deleted the feat/openrouter-defaults-picker branch November 16, 2026 18:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. dco-signoff: yes Indicates the PR's author has signed the DCO. lgtm Indicates that a PR is ready to be merged. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant