Skip to content

feat(server): expose input image capabilities on /v1/models - #160

Merged
deLiseLINO merged 1 commit into
mainfrom
feat/models-vision
Nov 30, 2026
Merged

deLiseLINO merged 1 commit into
mainfrom
feat/models-vision

Conversation

@deLiseLINO

Copy link
Copy Markdown
Owner

Why

Clients that inspect GET /v1/models to detect vision support (such as OpenRouter/LiteLLM-style clients, Cursor, or Natively) could not tell whether Prism models accept images because /v1/models only returned id, object, display_name, and output_modalities for image generators. Prism already resolves image input support internally via ResolveImageSource, combo ImageInput, and the vision sidecar.

Scope

  • internal/server/operations.go:
    • Add optional input_modalities, architecture.input_modalities, and capabilities.{input_modalities, supports_vision} fields to modelWire.
    • Resolve image input capability for routes, aliases, combos, and claude-<provider>--<model> aliases using ResolveImageSource, combo ImageInput, and active VisionSidecar.
    • Omit vision metadata when capability is unknown (source == "none" and no active sidecar) rather than falsely advertising text-only.
  • internal/server/server_test.go: add TestModelsVisionCapabilities covering vision, text-only, unknown models, routes, combos (ImageInput, mixed, all-vision), and vision sidecar override.

Blast Radius

Only GET /v1/models response 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

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
deLiseLINO merged commit 067ed4c into main Nov 30, 2026
3 checks passed
@deLiseLINO
deLiseLINO deleted the feat/models-vision branch November 30, 2026 22:32
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
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.

1 participant