← Back to list

Multimodal — images & document understanding

Vision-capable models accept content parts of type image_url: image_url

python
resp = client.chat.completions.create(
    model="gpt-4o",
    messages=[{
        "role": "user",
        "content": [
            {"type": "text", "text": "How many cats are in this image?"},
            {"type": "image_url", "image_url": {"url": "https://.../cats.png"}}
        ]
    }],
)

Image token billing

Each image is billed as roughly 1,000 ~ 4,000 tokens depending on resolution. The count rolls up into the response's usage.prompt_tokens.