Use the AutoGLM Image Recognition API to analyze and describe image content. Use this skill when the user needs image analysis, object or scene recognition, OCR-like text extraction, or a general image description. The token is fetched automatically from the local service at http://127.0.0.1:18432/get_token, so no manual environment variable setup is required. If the user provides a local image file, you must first run upload-mix.py to upload it and obtain a public URL before using this skill.
Use the AutoGLM Image Recognition API to analyze and describe an image.
Prerequisite: Get a Public Image URL
This skill requires image_url to be a publicly accessible URL. Choose the correct path based on the source of the image:
Image source
What to do
Existing public URL (http:// or https://)
Use it directly with no extra processing
Local file (user upload or local path)
You must run upload-mix.py first, then pass the returned public URL
Important: If the user provides a local image, such as an uploaded file or a local disk path, do not pass the file path directly.
Run upload-mix.py first to upload the file, obtain a public URL, and only then perform image recognition.
Step 1 for a Local Image: Upload with upload-mix.py
# Pass only the image URL and use the default prompt
python image-recognition.py "https://example.com/image.jpg"
# Pass the image URL with a custom prompt
python image-recognition.py "https://example.com/image.jpg" "Extract the text shown in the image"
Note: Image recognition may take longer than other calls. Wait for the response.
If you need a timeout, change the request call in image-recognition.py to:
python
with urllib.request.urlopen(req, timeout=300) as resp:
A timeout of 300 seconds is recommended.
Full Workflow
text
User provides a local image
↓
Run upload-mix.py to upload the image
python upload-mix.py "<local image path>"
↓
Extract data.oss_info[0].oss_url as image_url
↓
Run image-recognition.py
python image-recognition.py "<image_url>" ["<prompt>"]
↓
Present data.text to the user
If the user already provides a public URL, skip the upload step:
text
User provides a public image URL
↓
Run image-recognition.py
python image-recognition.py "<image_url>" ["<prompt>"]
↓
Present data.text to the user
1. Present the recognition result directly
Return the contents of data.text directly to the user and preserve the original formatting, including any Markdown emphasis.