Skip to content
API referenceVision (images)

Vision (images)

Images: supported forms and limits of the selected API.

Model protocol

Messages without a server prompt

Without an applied server prompt POST /v1/messages, images are passed in an image block. Base64 is the most reliable option because the file is already inside the request and does not depend on an external host.

json
{
  "model": "claude-opus-5",
  "max_tokens": 1024,
  "messages": [{
    "role": "user",
    "content": [
      {"type": "image", "source": {
        "type": "base64", "media_type": "image/jpeg", "data": "<BASE64>"
      }},
      {"type": "text", "text": "What's in the image?"}
    ]
  }]
}

URL — a direct public file only

json
{"type": "image", "source": {"type": "url", "url": "https://example.com/photo.jpg"}}
  • Formats: JPEG, PNG, GIF, WebP.
  • Anthropic limits each image to 10 MB of base64-encoded data and 8000×8000 px. With more than 20 images, resize each side to 2000 px or less to stay within the stricter many-image limit.
  • One API request allows up to 100 images with a 200k context window and up to 600 with a 1M context window; request size and token limits may stop processing sooner.
  • GIF animation is not played — Claude analyzes only the first frame.
  • The URL must be a direct public https:// resource with no authentication, cookies, login page, or anti-bot challenge.
  • The server must consistently return the correct image MIME (image/jpeg, image/png, image/gif, or image/webp).
  • Guard does not download the URL itself: the address is passed through in the Claude Messages request without a server prompt for remote retrieval.
  • Anthropic's official count_tokens may reject a URL source even when Messages accepts the same file. For /v1/messages, Guard skips that internal count preflight and uses a safe full-context reserve; send the image as base64 when you need a preliminary exact count.
  • Redirects, CDN protection, hotlink protection, and temporary signed URLs may fail. Availability from an arbitrary external host is not guaranteed.
  • If a URL is rejected, download the file yourself and send base64.
  • Multiple images are allowed while the whole request remains under the limit.
  • Images count as input tokens (depends on resolution) — see Billing.

GPT-6 Sol and Luna

Fresh native metadata advertises text and image input modalities for GPT-6 Sol and GPT-6 Luna. Use images only in the supported shape of the selected API; image metadata does not create a /v1/files alias.

Kimi, Composer and Grok

FamilyImage input
Kimiimage_url, input_image and image blocks are accepted and passed to the model as they are; video blocks behave the same way
Composerno: 400 cursor_image_input_unavailable before any charge
Grok 4.6yes: inline base64, up to 16 images per request, image/png, image/jpeg, image/webp, image/gif
Grok 4.7no: 400 cursor_image_input_unavailable before any charge
json
{
  "model": "cursor-grok-4.6-high",
  "max_tokens": 512,
  "messages": [{
    "role": "user",
    "content": [
      {"type": "image", "source": {"type": "base64", "media_type": "image/png", "data": "iVBORw0…"}},
      {"type": "text", "text": "What is in the picture?"}
    ]
  }]
}

PNG with GLM 5.3 Flash

Image input is confirmed only for glm-5.3-flash. Send PNG as base64/data URL in the native shape for the selected API.

APIContent block
Chatimage_url.image_url.url = data:image/png;base64,…
Messagesimage.source = {type: base64, media_type: image/png, data: …}
Responsesinput_image.image_url = data:image/png;base64,…

Chat Completions:

json
{
  "model": "glm-5.3-flash",
  "max_tokens": 4096,
  "messages": [{"role": "user", "content": [
    {"type": "text", "text": "Describe the image"},
    {"type": "image_url", "image_url": {"url": "data:image/png;base64,<base64>"}}
  ]}]
}

Messages:

json
{
  "model": "glm-5.3-flash",
  "max_tokens": 4096,
  "messages": [{"role": "user", "content": [
    {"type": "text", "text": "Describe the image"},
    {"type": "image", "source": {
      "type": "base64", "media_type": "image/png", "data": "<base64>"
    }}
  ]}]
}

Responses:

json
{
  "model": "glm-5.3-flash",
  "max_output_tokens": 4096,
  "store": false,
  "input": [{"role": "user", "content": [
    {"type": "input_text", "text": "Describe the image"},
    {"type": "input_image", "image_url": "data:image/png;base64,<base64>"}
  ]}]
}

Gemini images

Gemini accepts images as embedded base64 data or as an https link: Google downloads the linked file itself. Send the image in the native form of the selected API.

APIImage block
Messagesimage with source.type: "base64", or source.type: "url" with an https address in url
Chat Completionsimage_url with an address of the form data:image/png;base64,… or an https address; detail only auto
Responsesinput_image with image_url: a data address or an https address

Chat Completions:

json
{
  "model": "gemini-4-argon",
  "max_tokens": 4096,
  "messages": [{"role": "user", "content": [
    {"type": "text", "text": "Describe the image"},
    {"type": "image_url", "image_url": {"url": "data:image/png;base64,<base64>"}}
  ]}]
}

Messages:

json
{
  "model": "gemini-4-argon",
  "max_tokens": 4096,
  "messages": [{"role": "user", "content": [
    {"type": "text", "text": "Describe the image"},
    {"type": "image", "source": {
      "type": "base64", "media_type": "image/png", "data": "<base64>"
    }}
  ]}]
}

Responses:

json
{
  "model": "gemini-4-argon",
  "max_output_tokens": 4096,
  "input": [{"role": "user", "content": [
    {"type": "input_text", "text": "Describe the image"},
    {"type": "input_image", "image_url": "data:image/png;base64,<base64>"}
  ]}]
}

A link instead of data, Messages:

json
{
  "type": "image",
  "source": {"type": "url", "url": "https://example.com/picture.png"}
}

Muse images

Muse accepts images as embedded base64 data: in Chat Completions and Responses it is a data address of the form data:image/png;base64,….

APIImage block
Messagesimage
Chat Completionsimage_url
Responsesinput_image

Sections

On this page