fix(provider): support custom provider image modalities - #51298
Open
saiqulhaq-hh wants to merge 1 commit into
Open
saiqulhaq-hh wants to merge 1 commit into
saiqulhaq-hh wants to merge 1 commit into
Conversation
… for custom-provider models (anomalyco#47480)
Contributor
|
The following comment was made by an LLM, it may be inaccurate: |
saiqulhaq-hh
marked this pull request as ready for review
September 25, 2026 08:32
This was referenced Sep 26, 2026
This branch has not been deployed
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.
Issue for this PR
Closes #47480
Type of change
What does this PR do?
Custom-provider models can reach the message filter with
capabilities.inputin the modalities array form, such as["text", "image"]. The filter only checked the object form (input.image), so it replaced valid image parts with a "model does not support image input" error before calling the provider.This change accepts both capability representations at that boundary: array capabilities use
includes(modality), while registry-derived object capabilities keep the existing keyed lookup. A regression test covers an image-capable custom-provider model using the array form.How did you verify your code works?
bun test test/provider/transform.test.tsfrompackages/opencode(586 passed)bun typecheckfrompackages/opencodebun run testfrompackages/opencode(3612 passed, 22 skipped, 1 todo)I also ran the patched CLI with
bun dev .and used the Read tool on a local image with this sanitized custom-provider configuration:{ "provider": { "litellm": { "npm": "@ai-sdk/openai-compatible", "options": { "baseURL": "https://<litellm-host>/v1", "apiKey": "{env:LITELLM_API_KEY}" }, "models": { "minimax/MiniMax-M3": { "name": "MiniMax M3", "attachment": true, "modalities": { "input": ["text", "image"] } } } } } }The model successfully parsed text from the image instead of receiving the unsupported-image error.
Screenshots / recordings
Local test result:
bun dev .Checklist
If you do not follow this template your PR will be automatically rejected.