TokAPI Docs

Image Analysis

Send images to vision-capable models using standard image content blocks.

There is no special endpoint for image analysis — you send image content blocks in a normal request. Vision-capable models include Claude Opus / Sonnet / Haiku and GPT models (input modalities: text, image, pdf).

Claude — POST /v1/messages

Send an image content block with either a URL or a base64 source:

curl https://api.tokapi.ai/v1/messages \
  -H "Authorization: Bearer sk-lazytech-..." \
  -H "anthropic-version: 2023-06-01" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-sonnet-4-6",
    "max_tokens": 512,
    "messages": [{
      "role": "user",
      "content": [
        { "type": "text", "text": "Describe what you see in this image." },
        { "type": "image", "source": { "type": "url", "url": "https://example.com/photo.jpg" } }
      ]
    }]
  }'

OpenAI-compatible — POST /v1/chat/completions

Use an image_url content part:

{ "type": "image_url", "image_url": { "url": "https://example.com/photo.jpg" } }

Base64 images

Base64 data URLs are also accepted. For Claude, use a base64 source with a media_type:

{
  "type": "image",
  "source": {
    "type": "base64",
    "media_type": "image/jpeg",
    "data": "<base64-encoded-bytes>"
  }
}

On this page