On this pageVision
Back to docs

Images, audio and video

Check formats and job lifecycles.

Check each model before sending images, audio or video. For asynchronous video, retain the job ID and poll its status; do not recreate jobs automatically after a disrupted response.

Vision

Models labeled Vision accept PNG/JPEG/WebP/GIF images. For Claude via Anthropic Messages, send a base64 image in the same content array as your question:

curl https://vietrouter.com.vn/v1/messages \
  -H "x-api-key: ${STALI_API_KEY:?STALI_API_KEY}" \
  -H "anthropic-version: 2023-06-01" \
  -H "content-type: application/json" \
  -d '{
    "model": "claude-fable-5",
    "max_tokens": 512,
    "messages": [{
      "role": "user",
      "content": [
        {
          "type": "image",
          "source": {
            "type": "base64",
            "media_type": "image/png",
            "data": "iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAIAAAAlC+aJAAAAXElEQVR4nO3PIREAIBAAsI+DQaPJhKbVF0JTggiIt7tbgcUds6LlKur7VISAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwM8D31WVS4B9/IAAAAAASUVORK5CYII="
          }
        },
        {"type": "text", "text": "Describe this image"}
      ]
    }]
  }'

16 GPT models use the native OpenAI image_url format at /v1/chat/completions. The gateway supports both base64 data URLs and http(s) image URLs:

{
  "model": "gpt-5.6-sol",
  "messages": [{
    "role": "user",
    "content": [
      {"type": "text", "text": "Read the content of this image"},
      {
        "type": "image_url",
        "image_url": {"url": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAIAAAAlC+aJAAAAXElEQVR4nO3PIREAIBAAsI+DQaPJhKbVF0JTggiIt7tbgcUds6LlKur7VISAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwM8D31WVS4B9/IAAAAAASUVORK5CYII="}
      }
    ]
  }]
}

Image tokens returned by the provider will be recorded and charged as input tokens. It is recommended to compress images before sending and keep the entire request content under the 20 MB limit.

Images, audio and video

Generate and edit images

JSON guides for image generation, references, results and pricing.

View the full guide

/v1/images/generations

curl https://vietrouter.com.vn/v1/images/generations \
  -H "Authorization: Bearer ${STALI_API_KEY:?STALI_API_KEY}" \
  -H "content-type: application/json" \
  -d '{
    "model": "req/gpt-image-2",
    "prompt": "a tiny red circle on white",
    "size": "1024x1024",
    "n": 1
  }'

/v1/images/edits

curl https://vietrouter.com.vn/v1/images/edits \
  -H "Authorization: Bearer ${STALI_API_KEY:?STALI_API_KEY}" \
  -H "content-type: application/json" \
  -d '{
    "model": "req/gpt-image-2",
    "prompt": "keep the same subject, soft studio lighting",
    "image": "https://example.com/reference.png",
    "size": "1024x1024",
    "n": 1
  }'

# image / image_url / reference_image / ref_image:
# data URL, base64 thuần, hoặc URL http(s) công khai
Create video

Examples receive source review and local checks; this does not establish compatibility with every app version. Check settings, send a small request and confirm usage before production use.

Zalo groupWhatsApp