Repository navigation
Conversation
- Add context_length, top_provider, supported_reasoning_levels, and metadata.display_name to every provider chat row, on top of the image capabilities from deLiseLINO#160.
erikfrish
force-pushed
the
feat/models-capabilities
branch
from
November 30, 2026 08:28
ff5e533 to
dcafb8c
Compare
deLiseLINO
pushed a commit
that referenced
this pull request
Dec 1, 2026
…dels (#162) 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 #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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Builds on #160, which adds image input to
/v1/models. Base isfeat/models-vision; it moves tomainonce #160 lands.Why
With #160 a client can tell from
/v1/modelswhether a model takes images, but it still gets no context window, no output limit, and no effort levels, so it falls back to defaults: a 1M Opus shows up as 256k. Prism already resolves these facts for routing. With them on the list, every client can take the server's models as is instead of keeping a hand-written copy per machine.Scope
handleModelsadds to eachclaude-<provider>--<model>row the fields OpenRouter-style clients read:context_lengthandtop_provider.context_length,top_provider.max_completion_tokenswhen the output limit is known,supported_reasoning_levelswhen effort levels are known, andmetadata.display_name: "<provider>/<model>".ResolveContextWindow,ResolveMaxOutput, andResolveEffortsSource, the ones routing uses, so a manual model setting comes first.id, top-leveldisplay_name, the image capability fields from feat(server): expose input image capabilities on /v1/models #160, and image rows stay the same. Route, alias, and combo rows get none of the new fields.TestModelsListsImageModelsWithOutputModalitiesnow checks that no row has the idgw/chat-a. It used to search the whole body for that string, which now legitimately appears inmetadata.display_name.verify/features/daemon-api.mddocuments the fields.Blast Radius
The change only adds response fields. Claude Code reads
id,type, anddisplay_name, and ignores the rest.Verification
go test -race ./internal/serverpasses, includingTestModelsVisionCapabilitiesfrom feat(server): expose input image capabilities on /v1/models #160.TestModelsCarriesChatModelFactssets a manual context window and efforts on a chat model and checks its row. It fails without this change.context_length.claude-dia-proxy--claude-opus-5-5returned the feat(server): expose input image capabilities on /v1/models #160 image fields pluscontext_length: 1000000(manual setting),max_completion_tokens: 128000, effortslowtomax, andmetadata.display_name: "dia-proxy/claude-opus-5-5". The four image model rows did not change.Model: claude-opus-5-5