Skip to content
Inference

Images

Use POST /v1/chat/completions with the quickstart setup.

Send an image

Replace messages in your request with this array:

[
  {
    "role": "user",
    "content": [
      {"type": "text", "text": "Describe this image."},
      {
        "type": "image_url",
        "image_url": {"url": "data:image/jpeg;base64,<encoded-image>"}
      }
    ]
  }
]

Replace <encoded-image> with base64 image bytes; use image/jpeg or image/png to match the file. Add more image_url items for multiple images.

Streaming and usage

Set stream: true to stream the text response. Image tokens count toward the input context and are charged at the model's input rate.