Problem
When sending images to custom OpenAI-compatible providers (e.g., Z.AI GLM 5.1), the detail field is not included in the image_url object. The current payload looks like:
{
"type": "image_url",
"image_url": {
"url": "data:image/png;base64,..."
}
}
Without detail, some providers default to "low", which heavily downscales the image. The model receives the image without error but can barely interpret its contents.
Expected behavior
The payload should include a detail field, defaulting to "high" or "auto":
{
"type": "image_url",
"image_url": {
"url": "data:image/png;base64,...",
"detail": "high"
}
}
Ideally this would also be configurable per-model in opencode.json (e.g., an image_detail option).
Location
internal/llm/provider/openai.go — where ChatCompletionContentPartImageImageURLParam is constructed. Only the URL field is set; Detail is omitted.
Note: the ImageURLContent struct in internal/message/content.go already has a Detail field, but it's never used in the OpenAI provider's convertMessages().
Reproduction
- Configure a custom provider using
@ai-sdk/openai-compatible (e.g., Z.AI GLM 5.1)
- Attach an image in a conversation
- The model accepts the image but gives vague or incorrect descriptions — consistent with receiving a low-resolution thumbnail
Problem
When sending images to custom OpenAI-compatible providers (e.g., Z.AI GLM 5.1), the
detailfield is not included in theimage_urlobject. The current payload looks like:{ "type": "image_url", "image_url": { "url": "data:image/png;base64,..." } }Without
detail, some providers default to"low", which heavily downscales the image. The model receives the image without error but can barely interpret its contents.Expected behavior
The payload should include a
detailfield, defaulting to"high"or"auto":{ "type": "image_url", "image_url": { "url": "data:image/png;base64,...", "detail": "high" } }Ideally this would also be configurable per-model in
opencode.json(e.g., animage_detailoption).Location
internal/llm/provider/openai.go— whereChatCompletionContentPartImageImageURLParamis constructed. Only theURLfield is set;Detailis omitted.Note: the
ImageURLContentstruct ininternal/message/content.goalready has aDetailfield, but it's never used in the OpenAI provider'sconvertMessages().Reproduction
@ai-sdk/openai-compatible(e.g., Z.AI GLM 5.1)