You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I paste an image into opencode, it keeps telling me that it cannot read images, after it has been attached. On version 1.0.134 it works, but not on 1.0.137 onwards.
I looked further into the issue and found that it works if I set the input modality to include image. So I think this might be an issue with the detection of models + modalities.
The particular case I faced: claude-sonnet-4-5-20250929 was not being detected as a model that could support images.
I get this error when using us.anthropic.claude-haiku-4-5-20251001-v1:0 and even us.anthropic.claude-sonnet-4-5-20250929-v1:0 but using global.anthropic.claude-opus-4-5-20251101-v1:0 works fine. Weirdly, when I switch back from Opus to Sonnet, it is able to read the image again.
@rekram1-node Is this something that the opencode team would consider ? In similar veins to the "small_model" having a "vision_model" could be interesting too
I think u can accomplish this via plugins, make a hook for on tool output, check if it has attachments, drop them from the tool call and instead call an llm to explain the image and say what it is or something
@rekram1-node I am not seeing any error, other than this message:
I'm unable to read image files directly as I don't have image input capabilities. However, I can help you in other ways:
1. Use an OCR tool - You could use an external tool to extract text from the image and paste it here
2. Describe the error - Tell me what error you're seeing and I can help troubleshoot
3. Check the file - Since the image is at /path/to/image.png, it seems to be related to a report error in your application
Could you describe what error is shown in the image, or paste any error messages you're seeing? That way I can help you fix the issue.
▣ Build · us.anthropic.claude-sonnet-4-5-20250929-v1:0 · 7.3s
When I switch to OPUS, it is able to read the image, and when I switch back to SONNET it is able to read the image. I then went ahead and got OPENCODE to debug the issue and search the logs, this is what it told me:
Based on the logs, I found the issue. The error message about the image appears to be generated client-side by >OpenCode, not from the actual logs. Here's what I found:
What happened with the image:
The log shows that when you tried to attach the image /path/to/image.png, OpenCode detected that:
The model being used (us.anthropic.claude-sonnet-4-5-20250929-v1:0 via Amazon Bedrock) does not support image >input
OpenCode intercepted this before sending the request to the API
It displayed the error message: ERROR: Cannot read "/path/to/image.png" (this model does not support image input)
Why this happened:
The error log shows AI_APICallError entries around the same timestamp (2025-12-23T15:34:16 and 2025-12->23T20:03:41), indicating the model was trying to process your request but couldn't handle the image attachment.
Solution:
To share images with me, you have a few options:
Describe the error - Tell me what you see in the image
Use a vision-capable model - Switch to a model that supports images (like Claude Sonnet 4 via Anthropic direct, or GPT->4 Vision)
Extract text - Use OCR to extract any text from the image and paste it here
What error are you seeing in the /path/to/image.png image? I'm happy to help troubleshoot once you describe
I looked further into the issue and found that it works if I set the input modality to include image. So I think this might be an issue with the detection of models + modalities.
The particular case I faced: claude-sonnet-4-5-20250929 was not being detected as a model that could support images.
I looked further into the issue and found that it works if I set the input modality to include image. So I think this might be an issue with the detection of models + modalities.我进一步调查了这个问题,发现如果我把输入模态设置为包含图片,它就能正常工作。所以我认为这可能是模型+模态检测的问题。
The particular case I faced: claude-sonnet-4-5-20250929 was not being detected as a model that could support images.我遇到的具体案例是:claude-sonnet-4-5-20250929 没有被检测到支持图像的模型。
For those interested, the property to set was:有兴趣的人,要设定的属性是:
{
"": {
//...
"modalities": { "input": ["image", "text"], "output": ["text"] }“模态”: { “输入”: [“图像”, “文本”], “输出”: [“文本”] }
}
{
Thanks a bunch this got Qwen 3.5 on LM studio to start reading images as well.非常感谢,这让 LM Studio 上的 Qwen 3.5 也能开始读取图像了。
@kenthinson How can I enable a multimodal model to understand images in opencode? In my tests, the LLM received base64 encoding, or did it fail to understand images correctly
Im using gemma 4 with custom provider and modalities option didn't work. But I was missing typing "npm": "@ai-sdk/openai-compatiple" in provider, and it worked after configuring it.
por que si este modelo dice qu epuede leer images y le mando una imagen y entonces me dice que no lo puede hacer? yo pague pensando en que sus modelos eran capaces de leer imágenes cuando no es asi. es una estafa?
por que si este modelo dice qu epuede leer images y le mando una imagen y entonces me dice que no lo puede hacer? yo pague pensando en que sus modelos eran capaces de leer imágenes cuando no es asi. es una estafa?
Im using gemma 4 with custom provider and modalities option didn't work. But I was missing typing "npm": "@ai-sdk/openai-compatiple" in provider, and it worked after configuring it.
It seems like the image understanding of capable models is still not used for all providers in OpenCode. I've tested this with various Ollama models capable of image usage. Other software tools (e.g. Open WebUI) or a simple Python script are also able to use the models capabilities. I do not understand why it is not available by default in OpenCode though...
The setup that worked for me was to use "modalities": { "input": ["image", "text"], "output": ["text"] } in the opencode.json alongside with the "npm": "@ai-sdk/openai-compatible".
Here is my config json example where ONLY gemma4:12b-it-q4_K_M works as it has the modalities addition:
If you would want to use images with the other models, you would need to add "modalities": { "input": ["image", "text"], "output": ["text"] } , too.
For anyone using an Ollama instance, here's a simple Python script for you to test if the model supports image input:
However, you could also have a look at the model description on https://ollama.com/library/<YOUR-MODEL>/tags
fromtkinterimportTk, filedialogimportollamafromrich.consoleimportConsolefromrich.markdownimportMarkdowndefimage_vision():
root=Tk()
root.withdraw()
image_path=filedialog.askopenfilename(defaultextension=".jpg", filetypes=[("Image files", "*.jpg"), ("Image files", "*.png"), ("Image files", "*.jpeg")])
response=ollama.chat(
model='YOUR-MODEL-NAME', # e.g. gemma4:12b-it-q4_K_Mmessages=[{
'role': 'user',
'content': 'What is in this image? If it is text extract the text and write it as Markdown. If there is no text describe the image. Answer in Spanish.',
'images': [image_path]
}]
)
console=Console()
console.print(response)
console.print(Markdown("## Response"))
console.print(Markdown(response['message']['content']))
defmain():
image_vision()
if__name__=="__main__":
main()
Which results in:
Response
Esta es una vista aérea o satelital de una zona urbana densamente construida, posiblemente una ciudad europea debido al estilo arquitectónico y los techos de teja roja.
En la parte superior central, se observa un gran parque con amplias áreas verdes, árboles y lo que parece ser un camino circular. A la derecha del parque, hay un campo deportivo rectangular con una pista de atletismo de color rojo. El resto de la imagen muestra una red de edificios compactos organizados a lo largo de calles y avenidas. Se pueden
distinguir diversas estructuras residenciales y comerciales, pequeños patios internos y zonas arboladas intercaladas entre las edificaciones.
Workaround : plugin opencode qui donne la vision aux modèles sans capacité image (testé avec deepseek-v4-flash sous OpenChamber 1.18.15, 07/08/2026).
Le problème exact décrit ici : quand on colle une image, opencode la stocke en base64 dans la DB (aucun fichier sur disque) et un modèle sans vision ne peut pas la traiter. Mon plugin vision-attachments intercepte le message utilisateur (hook chat.message), écrit l'image sur disque (/tmp/opencode-vision/), retire la part image et injecte une note texte avec le chemin → l'agent appelle automatiquement l'outil analyze_image d'un MCP vision externe (ex: opencode-vision avec Gemini 2.5 Flash free tier) qui renvoie une description texte lisible par le modèle principal.
Pièges documentés dans le README (muter output.parts par splice au lieu de réassigner, hériter id/messageID/sessionID de la part remplacée, ne pas throw dans le hook). En espérant qu'un support natif arrive un jour 👍
@rekram1-node J'ai implémenté exactement l'approche que tu avais esquissée ici (hook, drop des attachments, appel d'un LLM vision externe pour décrire l'image). Plugin opencode testé avec deepseek-v4-flash sous OpenChamber 1.18.15 : https://github.com/zagg/opencode-vision-attachments — les pièges (muter output.parts par splice, hériter les IDs) sont documentés dans le README. 👍
Closing as stale. This was reported as a regression in v1.0.137 with LiteLLM + Vertex AI, and model and attachment handling has been rewritten since then. Later comments here describe a different case: models that don't support images.
If images still fail on the latest version with a model that supports vision, please open a new issue with your provider config, model, and version.
Activity
github-actions commentedon Dec 11, 2025
This issue might be a duplicate of existing issues. Please check:
Feel free to ignore if none of these address your specific case.
conradkoh commentedon Dec 11, 2025
I looked further into the issue and found that it works if I set the input modality to include image. So I think this might be an issue with the detection of models + modalities.
The particular case I faced:
claude-sonnet-4-5-20250929was not being detected as a model that could support images.For those interested, the property to set was:
{ "<model>": { //... "modalities": { "input": ["image", "text"], "output": ["text"] } } {rekram1-node commentedon Dec 11, 2025
was it custom or is it one that we show in models.dev
mitermayer commentedon Dec 17, 2025
Is there a setting on opencode to set "default_image_model" to handle image inputs when the current model is not able to process it ?
rekram1-node commentedon Dec 17, 2025
there isnt no
MrBazzieB commentedon Dec 17, 2025
I get this error when using
us.anthropic.claude-haiku-4-5-20251001-v1:0and evenus.anthropic.claude-sonnet-4-5-20250929-v1:0but using global.anthropic.claude-opus-4-5-20251101-v1:0works fine. Weirdly, when I switch back from Opus to Sonnet, it is able to read the image again.rekram1-node commentedon Dec 18, 2025
@MrBazzieB what error are you seeing>
mitermayer commentedon Dec 21, 2025
@rekram1-node Is this something that the opencode team would consider ? In similar veins to the "small_model" having a "vision_model" could be interesting too
rekram1-node commentedon Dec 21, 2025
I think u can accomplish this via plugins, make a hook for on tool output, check if it has attachments, drop them from the tool call and instead call an llm to explain the image and say what it is or something
rekram1-node commentedon Dec 21, 2025
but yeah maybewe need something better for that behavior
MrBazzieB commentedon Dec 24, 2025
@rekram1-node I am not seeing any error, other than this message:
When I switch to OPUS, it is able to read the image, and when I switch back to SONNET it is able to read the image. I then went ahead and got OPENCODE to debug the issue and search the logs, this is what it told me:
kenthinson commentedon Mar 8, 2026
Thanks a bunch this got Qwen 3.5 on LM studio to start reading images as well.
narcissus1024 commentedon Mar 10, 2026
@kenthinson How can I enable a multimodal model to understand images in opencode? In my tests, the LLM received base64 encoding, or did it fail to understand images correctly
kim-youngseop-developer commentedon Apr 3, 2026
Im using gemma 4 with custom provider and modalities option didn't work. But I was missing typing
"npm": "@ai-sdk/openai-compatiple"in provider, and it worked after configuring it.kelvin2403901 commentedon Jun 6, 2026
por que si este modelo dice qu epuede leer images y le mando una imagen y entonces me dice que no lo puede hacer? yo pague pensando en que sus modelos eran capaces de leer imágenes cuando no es asi. es una estafa?

CodeMazeSolver commentedon Jul 6, 2026
It seems like the image understanding of capable models is still not used for all providers in OpenCode. I've tested this with various Ollama models capable of image usage. Other software tools (e.g. Open WebUI) or a simple Python script are also able to use the models capabilities. I do not understand why it is not available by default in OpenCode though...
The setup that worked for me was to use
"modalities": { "input": ["image", "text"], "output": ["text"] }in the opencode.json alongside with the"npm": "@ai-sdk/openai-compatible".Here is my config json example where ONLY
gemma4:12b-it-q4_K_Mworks as it has the modalities addition:{ "$schema": "https://opencode.ai/config.json", "provider": { "ollama": { "models": { "qwen3.6:27b-q4_K_M": { "_launch": true, "name": "qwen3.6:27b-q4_K_M" }, "gemma4:26b-a4b-it-q4_K_M": { "name": "gemma4:26b-a4b-it-q4_K_M" }, "gemma4:12b-it-q4_K_M": { "name": "gemma4:12b-it-q4_K_M", "modalities": { "input": ["image", "text"], "output": ["text"] } }, "gemma4:e4b-it-q4_K_M": { "name": "gemma4:e4b-it-q4_K_M" }, "qwen3-vl:8b-instruct-q4_K_M": { "name": "qwen3-vl:8b-instruct-q4_K_M" }, "ministral-3:14b-instruct-2512-q4_K_M": { "name": "ministral-3:14b-instruct-2512-q4_K_M" } }, "name": "Ollama", "npm": "@ai-sdk/openai-compatible", "options": { "baseURL": "http://127.0.0.1:11434/v1" } } } }If you would want to use images with the other models, you would need to add
"modalities": { "input": ["image", "text"], "output": ["text"] }, too.For anyone using an Ollama instance, here's a simple Python script for you to test if the model supports image input:
However, you could also have a look at the model description on
https://ollama.com/library/<YOUR-MODEL>/tagsWhich results in:
zagg commentedon Aug 7, 2026
Workaround : plugin opencode qui donne la vision aux modèles sans capacité image (testé avec deepseek-v4-flash sous OpenChamber 1.18.15, 07/08/2026).
Le problème exact décrit ici : quand on colle une image, opencode la stocke en base64 dans la DB (aucun fichier sur disque) et un modèle sans vision ne peut pas la traiter. Mon plugin
vision-attachmentsintercepte le message utilisateur (hookchat.message), écrit l'image sur disque (/tmp/opencode-vision/), retire la part image et injecte une note texte avec le chemin → l'agent appelle automatiquement l'outilanalyze_imaged'un MCP vision externe (ex:opencode-visionavec Gemini 2.5 Flash free tier) qui renvoie une description texte lisible par le modèle principal.→ https://github.com/zagg/opencode-vision-attachments
Pièges documentés dans le README (muter
output.partspar splice au lieu de réassigner, hériter id/messageID/sessionID de la part remplacée, ne pas throw dans le hook). En espérant qu'un support natif arrive un jour 👍zagg commentedon Aug 7, 2026
@rekram1-node J'ai implémenté exactement l'approche que tu avais esquissée ici (hook, drop des attachments, appel d'un LLM vision externe pour décrire l'image). Plugin opencode testé avec deepseek-v4-flash sous OpenChamber 1.18.15 : https://github.com/zagg/opencode-vision-attachments — les pièges (muter output.parts par splice, hériter les IDs) sont documentés dans le README. 👍
neriousy commentedon Oct 1, 2026
Closing as stale. This was reported as a regression in v1.0.137 with LiteLLM + Vertex AI, and model and attachment handling has been rewritten since then. Later comments here describe a different case: models that don't support images.
If images still fail on the latest version with a model that supports vision, please open a new issue with your provider config, model, and version.