Response structure

{
  "created": 1719000000,
  "data": [{ "url": "https://...", "b64_json": "..." }],
  "usage": {
    "images": 1,
    "input_tokens":  { "image_tokens": 0,    "text_tokens": 32 },
    "output_tokens": { "image_tokens": 4096, "text_tokens": 0  },
    "total_tokens": 4096
  },
  "task_id": "uuid",          // async task mode only
  "task_status": "pending"    // async task mode only
}

Field descriptions

  • data — Image array. Each entry has url (default) or b64_json (when response_format: "b64_json")
  • usage.images — Image count for per-image billing; input_tokens/output_tokens for per-token billing
  • created — Unix timestamp (seconds)
  • task_id / task_status — Only present when task: true; data is empty in this case

Per-token billing example

{
  "usage": {
    "input_tokens":  { "image_tokens": 0,    "text_tokens": 32 },
    "output_tokens": { "image_tokens": 4096, "text_tokens": 0  },
    "total_tokens": 4128,
    "cached_tokens": { "image_tokens": 0, "text_tokens": 0 }
  }
}

Per-image billing example

{
  "usage": {
    "images": 1,
    "total_tokens": 4096
  }
}

Next steps

Stream responses · Async tasks