Repository navigation
feat(server): expose input image capabilities on /v1/models - #160
Merged
Merged
Conversation
erikfrish
added a commit
to erikfrish/prism
that referenced
this pull request
Nov 30, 2026
- 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.
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.
Why
Clients that inspect
GET /v1/modelsto detect vision support (such as OpenRouter/LiteLLM-style clients, Cursor, or Natively) could not tell whether Prism models accept images because/v1/modelsonly returnedid,object,display_name, andoutput_modalitiesfor image generators. Prism already resolves image input support internally viaResolveImageSource, comboImageInput, and the vision sidecar.Scope
internal/server/operations.go:input_modalities,architecture.input_modalities, andcapabilities.{input_modalities, supports_vision}fields tomodelWire.claude-<provider>--<model>aliases usingResolveImageSource, comboImageInput, and activeVisionSidecar.source == "none"and no active sidecar) rather than falsely advertising text-only.internal/server/server_test.go: addTestModelsVisionCapabilitiescovering vision, text-only, unknown models, routes, combos (ImageInput, mixed, all-vision), and vision sidecar override.Blast Radius
Only
GET /v1/modelsresponse JSON gains optional capability fields for chat models with known image-input status; image generation rows and unknown models are unchanged.Verification
go test -race -count=1 ./internal/server/...— passed.go vet ./internal/server/...— passed.Model: gemini-4-neon