Multimodal Inputs

The chat completions endpoint accepts more than just text — depending on the model, you can include images, files (PDFs and plain text), audio, and video alongside your prompt. The model still responds with text; multimodal inputs let it see and hear what you're asking about, not generate media in return.

Checking Model Support

Each model declares which inputs it supports — and any size, count, or format limits — in its entry from the /v1/models endpoint. Inspect the inputs field before sending a non-text request. See Models for more on the model catalogue.

curl https://api.blockchain.info/ai/api/v1/models \
  -H "Authorization: Bearer $JUNE_API_KEY"

A truncated example response:

{
  "id": "anthropic/claude-sonnet-4.6",
  "inputs": {
    "text": { "supported": true },
    "image": {
      "supported": true,
      "maxCount": 20,
      "maxBytesPerFile": 5000000,
      "supportedTypes": [".gif", ".jpeg", ".jpg", ".png", ".webp"]
    },
    "file": {
      "supported": true,
      "pdf": { "supported": true, "maxBytesPerFile": 30000000 },
      "text": { "supported": true }
    },
    "audio": { "supported": false }
  }
}

Building a Multimodal Message

Instead of a plain string, set content to an array of typed parts. Mix and match text parts with the input types below.

Images

Pass images as either a public URL or a base64-encoded data URL. We recommend putting your text prompt before the image.

curl https://api.blockchain.info/ai/api/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $JUNE_API_KEY" \
  -d '{
    "model": "anthropic/claude-sonnet-4.6",
    "messages": [
      {
        "role": "user",
        "content": [
          { "type": "text", "text": "What is in this image?" },
          {
            "type": "image_url",
            "image_url": { "url": "https://example.com/photo.jpg" }
          }
        ]
      }
    ]
  }'

Files (PDFs & Text)

Use a file part for PDFs or plain-text documents. The file_data field accepts either a public URL or a base64-encoded data URL. For models that don't natively support file input, June parses the file and feeds the parsed content to the model — you don't need to do anything different.

curl https://api.blockchain.info/ai/api/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $JUNE_API_KEY" \
  -d '{
    "model": "anthropic/claude-sonnet-4.6",
    "messages": [
      {
        "role": "user",
        "content": [
          { "type": "text", "text": "Summarise the key points." },
          {
            "type": "file",
            "file": {
              "filename": "whitepaper.pdf",
              "file_data": "https://bitcoin.org/bitcoin.pdf"
            }
          }
        ]
      }
    ]
  }'

Audio

Audio inputs must be base64-encoded — URLs are not supported. Include the format field so the model knows how to decode the bytes (typically wav or mp3; check the model's inputs.audio.supportedFormats).

AUDIO_B64=$(base64 < recording.wav)

curl https://api.blockchain.info/ai/api/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $JUNE_API_KEY" \
  -d "{
    \"model\": \"google/gemini-3.1-pro\",
    \"messages\": [
      {
        \"role\": \"user\",
        \"content\": [
          { \"type\": \"text\", \"text\": \"Transcribe this audio.\" },
          {
            \"type\": \"input_audio\",
            \"input_audio\": { \"data\": \"$AUDIO_B64\", \"format\": \"wav\" }
          }
        ]
      }
    ]
  }"

Video

Video inputs use the video_url content type, with either a public URL or a base64-encoded data URL. Support is limited — check inputs.video on the model before sending.

{
  "role": "user",
  "content": [
    { "type": "text", "text": "Describe what is happening in this video." },
    {
      "type": "video_url",
      "video_url": { "url": "https://example.com/clip.mp4" }
    }
  ]
}

Next Steps