Skip to content

Image detail parameter missing in OpenAI-compatible provider image payloads #24242

Closed as not planned

Description

@gabrielttavares

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

  1. Configure a custom provider using @ai-sdk/openai-compatible (e.g., Z.AI GLM 5.1)
  2. Attach an image in a conversation
  3. The model accepts the image but gives vague or incorrect descriptions — consistent with receiving a low-resolution thumbnail

Activity

  1. added
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on Apr 25, 2026
  2. removed
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on May 3, 2026
  3. github-actions commented on Jul 4, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions