Repository navigation
feat(server): list known context, output limit, and efforts on /v1/models - #162
Merged
Merged
Conversation
…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.
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.
Replaces #161, which GitHub closed when its base branch
feat/models-visionwas deleted on the merge of #160.Why
After #160 a client can tell from
/v1/modelswhether 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_lengthover 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
GET /v1/modelsadd these fields, each only when known:context_lengthandtop_provider.context_length: from a manual setting, the provider listing, or the catalog. The global default window is never listed.max_output_tokensandtop_provider.max_completion_tokens: the same limit, under the flat name most gateways emit and the OpenRouter name. omp reads both.supported_reasoning_levelsanddefault_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 frominternal/daemontoconfig.DefaultReasoningEffort, so both use one function.metadata.display_name:<provider>/<model>onclaude-<provider>--<model>rows, the combo's display name on combos.imageInputor the vision sidecar is on. A text-only target still makes the combo text-only.verify/features/daemon-api.mddescribes 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, anddisplay_nameand ignores the rest. Image generation rows do not change.Verification
go test -race -count=1 ./internal/server/ ./internal/config/ ./internal/daemon/passes.go veton the same packages is clean.TestModelsCarriesChatModelFactschecks 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.TestModelsVisionCapabilitiesadds a combo of a vision model and a model with unknown image support. It now reports unknown.Model: claude-opus-5-5