Z.AI GLM-4.7 cannot read images from Read tool (model supports vision) #9163

Open
opened 2026-02-16 18:11:47 -05:00 by yindo · 1 comment
Owner

Originally created by @Llegion404 on GitHub (Feb 12, 2026).

Originally assigned to: @rekram1-node on GitHub.

Bug Description

GLM-4.7 is a multimodal model with vision support, but when using the Read tool to read image files with Z.AI (zai-coding-plan), the model says "I cannot read the image".

Expected Behavior

The model should be able to read and analyze image content, similar to how Claude, GPT-4, and other vision-capable models work.

Actual Behavior

When asking GLM-4.7 to read an image file using the Read tool:

  • Error message: "Cannot read "/path/to/image.jpg" (this model does not support image input). Inform the user."
  • Pasting images directly in messages works fine
  • GLM-4.7 itself supports vision (can read images in other contexts)

Root Cause

The `supportsMediaInToolResults` function in `packages/opencode/src/session/message-v2.ts` doesn't include `@ai-sdk/openai-compatible` (used by Z.AI).

Current supported SDKs:

  • `@ai-sdk/anthropic`
  • `@ai-sdk/openai`
  • `@ai-sdk/amazon-bedrock`
  • `@ai-sdk/google-vertex/anthropic`
  • `@ai-sdk/google` (Gemini-3 only)

Suggested Fix

Add `@ai-sdk/openai-compatible` to the `supportsMediaInToolResults` list:

```typescript
if (model.api.npm === "@ai-sdk/openai-compatible") {
// Z.AI GLM models support vision
return true
}
```

Related Issues

Environment

  • OpenCode version: 1.1.60
  • Provider: Z.AI (GLM Coding Plan)
  • Model: GLM-4.7
Originally created by @Llegion404 on GitHub (Feb 12, 2026). Originally assigned to: @rekram1-node on GitHub. ## Bug Description GLM-4.7 is a multimodal model with vision support, but when using the Read tool to read image files with Z.AI (zai-coding-plan), the model says \"I cannot read the image\". ## Expected Behavior The model should be able to read and analyze image content, similar to how Claude, GPT-4, and other vision-capable models work. ## Actual Behavior When asking GLM-4.7 to read an image file using the Read tool: - Error message: \"Cannot read \"/path/to/image.jpg\" (this model does not support image input). Inform the user.\" - Pasting images directly in messages works fine - GLM-4.7 itself supports vision (can read images in other contexts) ## Root Cause The \`supportsMediaInToolResults\` function in \`packages/opencode/src/session/message-v2.ts\` doesn't include \`@ai-sdk/openai-compatible\` (used by Z.AI). Current supported SDKs: - \`@ai-sdk/anthropic\` - \`@ai-sdk/openai\` - \`@ai-sdk/amazon-bedrock\` - \`@ai-sdk/google-vertex/anthropic\` - \`@ai-sdk/google\` (Gemini-3 only) ## Suggested Fix Add \`@ai-sdk/openai-compatible\` to the \`supportsMediaInToolResults\` list: \`\`\`typescript if (model.api.npm === \"@ai-sdk/openai-compatible\") { // Z.AI GLM models support vision return true } \`\`\` ## Related Issues - Similar issue was fixed for Kimi K2.5 in PR #11323 - Z.AI provider documentation: https://opencode.ai/docs/providers#zai ## Environment - OpenCode version: 1.1.60 - Provider: Z.AI (GLM Coding Plan) - Model: GLM-4.7
Author
Owner

@kassieclaire commented on GitHub (Feb 15, 2026):

GLM-4.7 is text-only, as described here:

Image
@kassieclaire commented on GitHub (Feb 15, 2026): GLM-4.7 is text-only, as described here: <img width="778" height="725" alt="Image" src="https://github.com/user-attachments/assets/ee353f9a-ce4d-40ab-b70c-4e8cfc88bfcd" />
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#9163