Skip to content

feat(server): list known context, output limit, and efforts on /v1/models - #162

Merged
deLiseLINO merged 1 commit into
deLiseLINO:mainfrom
erikfrish:feat/models-capabilities
Dec 1, 2026
Merged

deLiseLINO merged 1 commit into
deLiseLINO:mainfrom
erikfrish:feat/models-capabilities

Conversation

@erikfrish

Copy link
Copy Markdown
Contributor

Replaces #161, which GitHub closed when its base branch feat/models-vision was deleted on the merge of #160.

Why

After #160 a client can tell from /v1/models whether a model takes images, but it still gets no context window, output limit, or effort levels. It falls back to its own defaults, so a 1M Opus shows up as 256k.

The facts must be listed only when Prism knows them. omp, the main client of this list, takes a listed context_length over its own catalog, so a listed global default would hide a correct window. The gateways compared (opencodex, OmniRoute, LiteLLM, CLIProxyAPI) all leave an unknown limit out for the same reason.

Scope

  • Chat rows on GET /v1/models add these fields, each only when known:
    • context_length and top_provider.context_length: from a manual setting, the provider listing, or the catalog. The global default window is never listed.
    • max_output_tokens and top_provider.max_completion_tokens: the same limit, under the flat name most gateways emit and the OpenRouter name. omp reads both.
    • supported_reasoning_levels and default_reasoning_level. Without a default level, omp starts on the lowest level. The default is picked like the omp and grok integrations do: medium, else high, else the first level. That rule moves from internal/daemon to config.DefaultReasoningEffort, so both use one function.
    • metadata.display_name: <provider>/<model> on claude-<provider>--<model> rows, the combo's display name on combos.
  • Routes and aliases get the facts of their target, combos the facts every enabled target shares: the smallest window and output limit, and the efforts all of them accept. A fact any enabled target does not know is left out for the whole combo, as opencodex does, so a fallback never lands on a model with a smaller window than listed.
  • Fixes combo image input from feat(server): expose input image capabilities on /v1/models #160. A combo with one enabled target of unknown image support no longer reports image input. It reports unknown, unless the combo sets imageInput or the vision sidecar is on. A text-only target still makes the combo text-only.
  • verify/features/daemon-api.md describes the fields and the combo rules.

Blast Radius

The change only adds response fields. The exception is a combo whose enabled targets include one with unknown image support: its image fields from #160 are now left out. Claude Code reads id, type, and display_name and ignores the rest. Image generation rows do not change.

Verification

  • go test -race -count=1 ./internal/server/ ./internal/config/ ./internal/daemon/ passes. go vet on the same packages is clean.
  • TestModelsCarriesChatModelFacts checks a provider row with a manual window, a listed output limit, and efforts. It also checks that a model with only the global default lists no limits, that a route takes its target's facts, that a combo takes the smallest limits and shared efforts, and that a combo with an unknown target lists nothing.
  • TestModelsVisionCapabilities adds a combo of a vision model and a model with unknown image support. It now reports unknown.

Model: claude-opus-5-5

…dels

- Add context_length, max_output_tokens, top_provider, supported_reasoning_levels, default_reasoning_level, and metadata.display_name to chat rows, each only when Prism knows it.
- Routes and aliases take their target's facts; combos take the smallest limits and shared efforts of their enabled targets.
- A combo with an enabled target of unknown image support no longer claims image input.
@deLiseLINO
deLiseLINO merged commit d54190c into deLiseLINO:main Dec 1, 2026
3 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