multimodal input
Send pictures, audio or other media per model agreement.
Confirm input capabilities first
Being able to generate images does not mean that it can understand any image format; the text model does not necessarily support vision. First confirm the input type, file size, pixels, quantity and supported URL or Base64 forms in the model details.
Chat image content block
{
"model": "VISION_MODEL_ID",
"messages": [
{
"role": "user",
"content": [
{
"type": "text",
"text": "描述图片中的主要物体。"
},
{
"type": "image_url",
"image_url": {
"url": "https://YOUR_ASSET_HOST/image.png"
}
}
]
}
]
}
The sample asset URL must be replaced with a readable HTTPS address that you control. Private materials need to be uploaded or inlined according to the methods supported by the upstream. You cannot simply expect the upstream to inherit the login status of this site.
Format and Privacy
Gemini uses parts and Anthropic uses corresponding media blocks. The Data URL must contain the correct MIME type and Base64 content; don’t just change the file extension. Avoid submitting faces, documents or other sensitive materials that you do not have permission to process.
Troubleshooting
403 or cannot be crawled. First check the validity period, hotlink prevention and access area of the material URL; 413 check the request and media size; 400 check the content block type and model capabilities. Just because the URL can be opened in your own browser does not mean that the upstream server can read it.
Start with a small picture
First select the visual model, save the above JSON as vision-request.json, replace the model and material URL and execute:
curl --fail-with-body https://dunduntoken.com/v1/chat/completions -H "Authorization: Bearer $DUNDUN_API_KEY" -H "Content-Type: application/json" --data-binary @vision-request.json
Start with a publicly accessible, non-sensitive test image and ask for answers about verifiable content in the image. After getting the correct answer, increase the number or size of pictures one by one.
How to choose the material method
| Method | Conditions of use | Error-prone points |
|---|---|---|
| HTTPS URL | Model service can read resources | Login status, expired signature, anti-leeching |
| Data URL | Model supports inline images | MIME, encoding and request size |
| Supplier Document ID | Current Channel Official Support | Account Attribution and Resource Lifecycle |
| Local path | The client is responsible for uploading or encoding | The upstream cannot read the path of your computer |
Multiple rounds and input budget
Whether you need to carry the image in each round depends on the protocol and state preservation. Don’t assume that all subsequent requests after the client uploads it can reference it. Control pixels, quantity and context to avoid submitting a large number of original images repeatedly. Attachment parsing and model vision are different capabilities. Successful PDF text extraction does not mean that any file can be input natively.