---
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, e.g. `image/png`, `image/jpeg`, `image/webp`, `image/svg+xml`. May be omitted if the format could not be determined. | image/png                                                                                                                                                 |
| `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/>}                                                 |