Discovery: take thinking-effort tiers from models.dev when a gateway advertises none
Description
Models discovered through a gateway or aggregator lose their thinking-effort ladder, even for models whose ladder is public knowledge. claude-opus-5 reached through a router lands as minimal, low, medium, high — or with no thinking at all — while the same model on the native anthropic provider correctly offers low, medium, high, xhigh, max.
Two mechanisms combine:
inheritReferenceThinking(packages/catalog/src/identity/reference.ts) refuses cross-provider inheritance by design, so the bundled reference's ladder never applies to a model served under a different provider name.discoverOpenAIModelsList(packages/coding-agent/src/config/model-discovery.ts) then has only the endpoint's ownsupported_parametersto work with. Most gateways forward a bare upstream id and nothing else, so it falls back to the generic four-tier default — or, for an id newer than the bundled catalog, toreasoning: falseand no thinking config at all.
The five-tier adaptive ladder is additionally gated on spec.api === "anthropic-messages" (packages/catalog/src/model-thinking.ts:692-696), which no gateway route ever is, so identity derivation cannot rescue this.
Meanwhile omp already downloads models.dev during discovery (packages/catalog/src/provider-models/openai-compat.ts, MODELS_DEV_URL, loadModelsDevReferences, mapModelsDevToModels) and maps name / reasoning / modalities / cost / limits from it — but ignores the one field that would fix this:
"claude-opus-5": {
"reasoning": true,
"reasoning_options": [{ "type": "effort", "values": ["low","medium","high","xhigh","max"] }]
}1605 models in models.dev currently publish an effort ladder.
Use Case
Anyone routing omp through a gateway — self-hosted (bifrost, LiteLLM), an aggregator (OpenRouter, Kilo, Zenmux, Vercel AI Gateway), or omp auth-gateway itself — gets a downgraded thinking selector for every model, with no config-side workaround short of hand-writing a thinking: override per model in models.yml. The information is already in a catalog omp fetches on the same code path.
It also silently caps quality: a user who picks xhigh/max on the native provider cannot select it at all through the gateway, and clampThinkingLevelForModel quietly downgrades the request.
Area
Provider / Model support
Proposed Solution
Index the models.dev reasoning_options[type=effort] ladders by model id and use them in discovery when the endpoint advertised none:
// packages/catalog/src/provider-models/openai-compat.ts
export function modelsDevEffortLadder(model: ModelsDevModel): Effort[] | undefined {
const values = model.reasoning_options?.find(option => option?.type === "effort")?.values;
if (!Array.isArray(values)) return undefined;
const ladder = THINKING_EFFORTS.filter(effort => values.includes(effort));
return ladder.length > 0 ? [...ladder] : undefined;
}
// memoized for an hour, so a refresh costs at most one fetch across all providers
export async function loadModelsDevEffortLadders(fetchImpl?: FetchImpl): Promise<ReadonlyMap<string, readonly Effort[]>>// packages/coding-agent/src/config/model-discovery.ts — discoverOpenAIModelsList
const advertisedEfforts = THINKING_EFFORTS.filter(effort => params.includes(`reasoning_effort:${effort}`));
const publishedEfforts = advertisedEfforts.length > 0 ? advertisedEfforts : lookupModelsDevEfforts(effortLadders, id);Details that matter:
- The endpoint wins. The vendor catalog is consulted only when
supported_parameterscarries noreasoning_effort:<tier>token. - Id resolution peels path segments, since models.dev keys a model under each host's own id:
gw/openrouter/anthropic/claude-opus-5→openrouter/anthropic/claude-opus-5→anthropic/claude-opus-5(OpenRouter's key) →claude-opus-5(Anthropic's). - Conflicting ladders: first wins, not widest. Bedrock omits tiers its Converse API cannot address; over-advertising an effort the upstream rejects is worse than offering one tier too few.
- No outbound request for local runtimes. Skipped for
lm-studio(its ids are not in the vendor catalog) and whenever every discovered model already advertised its tiers.
Verified end to end against a live gateway: gw/anthropic/claude-opus-5 goes from reasoning: false/no ladder to low, medium, high, xhigh, max, matching the native provider. Regression test covers both the hit and the "model the catalog doesn't know stays untouched" case. Happy to open a PR.
Alternatives Considered
- Per-model
thinking:overrides inmodels.yml. Works, but it is per model per provider, and a gateway catalog is thousands of entries that change weekly. - Relax
inheritReferenceThinkingto allow cross-provider inheritance. Rejected upstream for good reason:effortRoutingis provider-specific wire routing, and fuzzy id matches (@modal/GLM-5-2-FP8→devin/glm-5-2) would rewrite unrelated models. The vendor ladder carries no wire routing, so it does not have that failure mode. - Make every gateway advertise
reasoning_effort:<tier>tokens. Correct long-term (OpenRouter'ssupported_parametersconvention already allows it) but omp cannot depend on hundreds of third-party endpoints adopting it.
Source: can1357/oh-my-pi