fix(opencode): Fixes image reading with OpenAI-compatible providers like Kimi K2.5.#11323
fix(opencode): Fixes image reading with OpenAI-compatible providers like Kimi K2.5.#11323rekram1-node merged 4 commits intoanomalyco:devfrom
Conversation
|
Hey! Your PR title Please update it to start with one of:
Where See CONTRIBUTING.md for details. |
|
The following comment was made by an LLM, it may be inaccurate: No duplicate PRs found |
b85ef8c to
741102c
Compare
|
Will look tmr, there is some granularity with other providers and packages, need to verify that this properly fixes all the providers Some have special cases like good for example, u can send attachments as tool results for the gemini-3 series models but no others |
|
I have the same issue but I am using Opus 4.5 via Google/Antigravity and Copilot providers. It works with some other models of these two providers. Claude models can't read images using the Read tool. Also tested it with this branch. Doesn't fix the issue for me. |
|
The copilot one makes sense why it'd have an issue, Ik how to fix w/ this branch, for antigravity im not really sure |
|
Okay I tested various providers, it should work fine now. Also added a text part too (some providers are more strict about that than others) |
|
/review |
…ike Kimi K2.5. (anomalyco#11323) Co-authored-by: Aiden Cline <63023139+rekram1-node@users.noreply.github.com> Co-authored-by: Aiden Cline <aidenpcline@gmail.com>
…ike Kimi K2.5. (anomalyco#11323) Co-authored-by: Aiden Cline <63023139+rekram1-node@users.noreply.github.com> Co-authored-by: Aiden Cline <aidenpcline@gmail.com>
…ike Kimi K2.5. (anomalyco#11323) Co-authored-by: Aiden Cline <63023139+rekram1-node@users.noreply.github.com> Co-authored-by: Aiden Cline <aidenpcline@gmail.com>
What does this PR do?
Fixes #11304.
Fixes #11306.
Fixes #11550.
Problem: When using the Read tool to read an image file, Claude works fine but OpenAI-compatible providers (Kimi, etc.) fail to see the actual image content. The model either dumps base64 data as text or hallucinates the image content.
Root cause: OpenAI-compatible Chat Completions API only supports string content in tool results. When the Read tool returns an image as an attachment, it gets
JSON.stringify()'d and the model can't interpret it as an image.Solution: For providers using
@ai-sdk/openai-compatibleSDK that support image input:How did you verify your code works?
/tmp/test.png(a dashboard screenshot)