Skip to content

Bug: Vision analysis fails with URL image input (HTTP 400) #3

Description

@dbigman

Description

When passing a URL (HTTP/HTTPS) as the image source to zai-cli vision analyze, the tool consistently fails with:

HTTP 400: {"error":{"code":"1210","message":"图片输入格式/解析错误"}}

This happens with both PNG and JPEG URLs. Local file paths work correctly — the CLI properly encodes them to base64 before sending to the API.

Steps to Reproduce

  1. zai-cli vision analyze "https://example.com/image.jpg" "What do you see?"
  2. Observe error 1210 repeated 3 times (retry logic kicks in)

Expected Behavior

URL images should be downloaded and encoded to base64 before being sent to the Z.AI chat completions API, same as local files.

Working Case (local file)

# Download the same image locally first
zai-cli vision analyze ./image.jpg "What do you see?"
# ✅ Works perfectly, returns detailed analysis

Environment

  • zai-cli v0.1.2 (npm global)
  • Node v24.11.1
  • Vision model: glm-5v-turbo (also fails with default glm-4.6v)
  • OS: Windows 10 (x64)

Root Cause

The image source handling in the vision analysis doesn't fetch URL content before passing to the API. The CLI passes the URL string directly instead of downloading and base64-encoding it first.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions