Files
bb6d66faa3 feat(providers): live model lists for OpenRouter and OpenGateway (#2084)
* feat(providers): fetch live model lists for OpenRouter and OpenGateway

Enable hybrid discovery so OpenGateway and OpenRouter load public
GET /v1/models catalogs (with coding filters on OpenRouter), matching
cairn-code and the Zero live-list fix.

Refs #2083

* Address live model discovery review feedback.

Remove hardcoded model allowlisting, deduplicate live MiMo routes, avoid duplicate startup probes, share mapping helpers, and strengthen provider documentation and tests.\n\nRefs #2083

* test(providers): Isolate OpenGateway picker discovery state.

Prevent persisted live discovery cache entries from making the static catalog assertion nondeterministic.

Refs #2083

* fix(test): restore OPENGATEWAY_API_KEY after discovery test

The no-auth OpenGateway discovery test deletes OPENGATEWAY_API_KEY but
originalEnv never snapshotted it and afterEach never restored it, so a
worker starting with the credential set would run every later test in
that worker without it. Snapshot and restore it like the other provider
env vars.

Refs #2084

* fix(integrations): preserve route shim maxTokensField for live-only discovered models

* fix(test): drop unrelated permissions.test.ts optional-chaining tweak

Not part of the OpenGateway/OpenRouter live discovery change; jatmn's
review on #2084 flagged it as unrelated drift that should be dropped
or split into its own PR.

Refs #2084

* docs(integrations): Add JSDoc comments to model mapping helpers

Add detailed JSDoc documentation for gateway model normalization,
tooling and reasoning support detection, and core model mapping type
guards and helpers across OpenGateway, OpenRouter, and modelMapping.

Refs #2083

* fix(integrations): address review feedback on live discovery and proxy credentials

Preserve caller credentials and custom headers for private route overrides, remove deep-research exclusion for text models, isolate test config directories, and align model picker assertions with upstream curated models.

Refs #2083
Refs #2084

* test(integrations): test explicit openaiShim precedence and removeBodyFields merge

Add unit test assertions verifying that explicit descriptor and catalog openaiShim configurations take precedence over inferred model settings and that removeBodyFields arrays merge correctly across layers.

Refs #2083
Refs #2084

* Filter expired catalog entries at discovery boundary and revert permissions test hunk.

Wrap static and merged route catalog model lists in filterAvailableCatalogEntries across all discoverModelsForRoute and refreshStartupDiscoveryForRoute return paths, preventing expired time-boxed catalog entries and live duplicates from resurfacing in model picker refresh, summary, or bootstrap additional options. Also restore permissions.test.ts to upstream/main without optional-chaining.

Refs #2084

* Fix ModelCatalogEntry type import in model test suite.

Import ModelCatalogEntry from descriptors.js rather than index.js to satisfy typecheck.

Refs #2084

---------

Co-authored-by: euxaristia <euxaristia@users.noreply.github.com>
2026-08-24 10:17:06 +08:00
..
2026-07-15 22:27:50 +08:00