API reference

Vision (images)

Attach images to a message and the model reads them. Use OpenAI's content-parts format; the gateway uploads each image to ChatGPT's file service and links it into the turn.

Message shape

Set content to an array mixing text and image parts. An image part carries either an inline base64 data URL or an http(s) URL the gateway will fetch:

{
  "messages": [
    {
      "role": "user",
      "content": [
        { "type": "text", "text": "What is in this picture?" },
        {
          "type": "image_url",
          "image_url": { "url": "data:image/png;base64,iVBORw0KGgoAAAANS..." }
        }
      ]
    }
  ]
}

An image hosted on the web works the same way — just give its URL:

{
  "type": "image_url",
  "image_url": { "url": "https://example.com/diagram.png" }
}

End-to-end example

Encode a local file to a data URL and send it. Python:

import base64
from openai import OpenAI

client = OpenAI(base_url="__BASE__/v1", api_key="YOUR_API_KEY")

with open("photo.jpg", "rb") as f:
    b64 = base64.b64encode(f.read()).decode()

resp = client.chat.completions.create(
    model="auto",
    messages=[{
        "role": "user",
        "content": [
            {"type": "text", "text": "Describe this image."},
            {"type": "image_url",
             "image_url": {"url": f"data:image/jpeg;base64,{b64}"}},
        ],
    }],
)
print(resp.choices[0].message.content)

OpenCode Muse Spark

With opencode/muse-spark-1.3-contributor-free, use the inline base64 image_url format shown above. Remote image URLs are not supported by this bridge. Images are attached in order through OpenCode, with the image count limit applied across the whole request. Temporary attachment files are deleted after the command; the stored OpenCode conversation may retain the images.

Limits & formats

ConstraintDefaultEnv
Images per message8MSE_MAX_IMAGES
Max size per image20 MBMSE_MAX_IMAGE_BYTES
Vision on/offonMSE_ENABLE_IMAGES

Recognised formats: PNG, JPEG, GIF, WebP, BMP. Accepted part types are image_url, input_image and image. A base64 payload inflates the request body by roughly 1.37×, which is why the body cap (MSE_MAX_BODY_BYTES, 32 MB) sits well above the per-image cap.

The upstream account must support vision, and images are uploaded per session (files are account-scoped). If an app can chat but its images are ignored, check that the client is actually sending image bytes — some tools need an "image" capability enabled first. See Client setup.