All models, capabilities, and prices

Vision (image input)

All Claude models accept images. Pass them inline as base64 or as a URL inside an image content block.

Image content block

Mix text and image blocks inside the same content array. The model treats them as a single ordered stream.

json
{
  "model": "claude-sonnet-5-5",
  "max_tokens": 512,
  "messages": [
    {
      "role": "user",
      "content": [
        { "type": "text", "text": "Describe this image in one sentence." },
        {
          "type": "image",
          "source": {
            "type":       "base64",
            "media_type": "image/png",
            "data":       "iVBORw0KGgoAAAANSUhEUgAAA..."
          }
        }
      ]
    }
  ]
}

URL source

The gateway also accepts a public HTTPS URL — we fetch it server-side before forwarding to the upstream.

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

Formats & limits

  • Media types: image/jpeg, image/png, image/gif, image/webp.
  • Up to 20 images per request and 5 MB per image before base64-encoding.
  • Animated GIFs are decoded to the first frame.
  • Vision tokens are billed as input tokens — a typical 1024×1024 image runs ~1600 tokens.

Python (file → base64)

python
import base64, mimetypes
from anthropic import Anthropic

client = Anthropic(base_url="https://api-ai.app")

def encode_image(path: str):
    with open(path, "rb") as f:
        data = base64.standard_b64encode(f.read()).decode("ascii")
    return {
        "type": "base64",
        "media_type": mimetypes.guess_type(path)[0] or "image/png",
        "data": data,
    }

msg = client.messages.create(
    model="claude-sonnet-5-5",
    max_tokens=512,
    messages=[{
        "role": "user",
        "content": [
            {"type": "text",  "text": "What's in this screenshot?"},
            {"type": "image", "source": encode_image("./screen.png")},
        ],
    }],
)
print(msg.content[0].text)

Picking a model for vision

  • OCR and dense text — claude-opus-4-8 when accuracy matters more than cost.
  • Object and scene description — claude-sonnet-5-5 as the balanced default.
  • Simple diagrams and UI screenshots — claude-haiku-4-5 for low-cost batch processing; move complex cases to Sonnet or Opus.
No image generation
Vision is input-only: Claude does not generate images on this endpoint. To generate images, see the Image generation guide.
Last updated: October 2, 2026Found a bug? admin@minedom-france.fr