---
title: "ImageGenCompletedEvent"
---

Emitted when generation completes and the final image is available


## Fields

| Field                                                                                                                                                         | Type                                                                                                                                                          | Required                                                                                                                                                      | Description                                                                                                                                                   | Example                                                                                                                                                       |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `b64_json`                                                                                                                                                    | *str*                                                                                                                                                         | :heavy_check_mark:                                                                                                                                            | Base64-encoded final image data                                                                                                                               |                                                                                                                                                               |
| `created`                                                                                                                                                     | *int*                                                                                                                                                         | :heavy_check_mark:                                                                                                                                            | Unix timestamp (seconds) when the image was generated                                                                                                         |                                                                                                                                                               |
| `media_type`                                                                                                                                                  | *Optional[str]*                                                                                                                                               | :heavy_minus_sign:                                                                                                                                            | Media type (MIME type) of the image. Omitted when the output is a standard raster format (PNG). Present for non-raster outputs such as SVG (`image/svg+xml`). | image/svg+xml                                                                                                                                                 |
| `type`                                                                                                                                                        | [components.ImageGenCompletedEventType](../components/imagegencompletedeventtype.mdx)                                                                          | :heavy_check_mark:                                                                                                                                            | The event type                                                                                                                                                |                                                                                                                                                               |
| `usage`                                                                                                                                                       | [Optional[components.ImageGenerationUsage]](../components/imagegenerationusage.mdx)                                                                            | :heavy_minus_sign:                                                                                                                                            | Token and cost usage for the image generation request, when available                                                                                         | \{<br/>"completion_tokens": 4175,<br/>"cost": 0.04,<br/>"prompt_tokens": 0,<br/>"total_tokens": 4175<br/>}                                                     |