Repository navigation
Description
Description
Two model IDs in the same provider that differ only in casing (MiniMax-M3.1-Flash vs minimax-m3.1-flash) are registered as two independent models. Model lookup is an exact match (model.id === ref.id in packages/core/src/model-resolver.ts), so each entry keeps its own capabilities — and nothing warns when the two entries declare different modalities.
The result is a silent modality downgrade with no pointer to the config key that controls it. Selecting the entry whose modalities.input is ["text"] while the provider's own config declares ["text", "image", "video"] makes every image attachment arrive as:
ERROR: Cannot read image (this model does not support image input). Inform the user.
The screenshot was captured correctly — packages/core/src/session/model-request.ts replaces the media part with that text before the request is built, because capabilities.input does not contain image. The message names the model capability but never names the config path to fix, so the natural first reading is "this model has no vision" rather than "this config entry under-declares its modalities".
Two related gaps:
- No validation for near-duplicate model IDs.
MiniMax-M3.1-Flashandminimax-m3.1-flashare the same upstream model, but nothing compares model IDs case-insensitively within a provider to flag the pair, nor to compare their declared modalities for a mismatch. - The downgrade message does not identify the offending config entry. It reports the model capability, not
provider.<id>.models.<id>.modalities.input, so there is no way to get from the error to the fix without manually auditing every model definition.
Plugins
None required; reproduced with a custom @ai-sdk/openai-compatible provider.
OpenCode version
2.2.5
Steps to reproduce
- Configure one provider with two model entries for the same upstream model, differing only in case, with different declared modalities:
{ "provider": { "custom": { "npm": "@ai-sdk/openai-compatible", "models": { "SomeModel-Flash": { "name": "Some Model Flash", "modalities": { "input": ["text"], "output": ["text"] } }, "somemodel-flash": { "name": "Some Model Flash", "modalities": { "input": ["text", "image", "video"], "output": ["text"] } } } } } } - Select the first entry and attach an image to a prompt.
- The image is replaced with
ERROR: Cannot read image (this model does not support image input). Inform the user., even though the upstream model accepts images (verified independently with a directcurlto the endpoint).
Screenshot and/or share link
Not attached; the failure is fully reproducible from the config above.
Operating System
Windows 11
Terminal
Windows Terminal
Two questions, since I am not sure which layer should own this:
- Would a config-time diagnostic be the right shape — warn on two model IDs in the same provider that differ only by case and declare different modalities? That would have surfaced the duplicate immediately.
- Or should the runtime downgrade message carry the offending config path (provider id + model id + the modality list that was actually applied), so the error points at the fix instead of at the model's abilities?
Activity
opencodejr commentedon Nov 9, 2026
Thanks for the detailed report and the minimal config.
OpenCode is currently doing what the config says. Model IDs are case-sensitive and matched exactly, so
SomeModel-Flashandsomemodel-flashare two separate models. Each one uses its ownmodalities. The entry you selected declaresinput: ["text"], so image attachments are replaced with theCannot read imagetext before the request is sent. Until something changes, you can fix it by removing the duplicate entry or adding"image"to that entry'smodalities.input.Your two suggestions would make this much easier to diagnose:
provider.custom.models.SomeModel-Flash.modalities.input) and the modalities that were applied.I've recorded this as a feature request for the maintainers to consider.
Related issues:
modalitiesproperty in custom provider configuration #9897: (closed) request to document themodalitiessetting for custom providers