SPB Git

Repository Public

edit-streaming-events.md 4.4 KB 233 lines markdown

1# Image edit streaming events23> For the complete documentation index, see [llms.txt](/llms.txt). Markdown versions of documentation pages are available by appending `.md` to the page URL.45Stream image generation and editing in real time with server-sent events.6[Learn more about image streaming](https://developers.openai.com/api/docs/guides/image-generation).78<a id="image_edit.partial_image"></a>910## image_edit.partial_image1112Emitted when a partial image is available during image editing streaming.1314### Schema1516Schema name: `ImageEditPartialImageEvent`1718- `b64_json: string`1920  Base64-encoded partial image data, suitable for rendering as an image.2122- `background: "transparent" or "opaque" or "auto"`2324  The background setting for the requested edited image.2526  - `"transparent"`2728  - `"opaque"`2930  - `"auto"`3132- `created_at: number`3334  The Unix timestamp when the event was created.3536- `output_format: "png" or "webp" or "jpeg"`3738  The output format for the requested edited image.3940  - `"png"`4142  - `"webp"`4344  - `"jpeg"`4546- `partial_image_index: number`4748  0-based index for the partial image (streaming).4950- `quality: "low" or "medium" or "high" or 3 more`5152  The quality setting for the requested edited image.5354  - `"low"`5556  - `"medium"`5758  - `"high"`5960  - `"xhigh"`6162  - `"max"`6364  - `"auto"`6566- `size: string or "1024x1024" or "1024x1536" or "1536x1024" or "auto"`6768  The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.6970  - `string`7172  - `"1024x1024" or "1024x1536" or "1536x1024" or "auto"`7374    The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.7576    - `"1024x1024"`7778    - `"1024x1536"`7980    - `"1536x1024"`8182    - `"auto"`8384- `type: "image_edit.partial_image"`8586  The type of the event. Always `image_edit.partial_image`.8788  - `"image_edit.partial_image"`8990### Example9192```json93{94  "type": "image_edit.partial_image",95  "b64_json": "...",96  "created_at": 1620000000,97  "size": "1024x1024",98  "quality": "high",99  "background": "transparent",100  "output_format": "png",101  "partial_image_index": 0102}103```104105<a id="image_edit.completed"></a>106107## image_edit.completed108109Emitted when image editing has completed and the final image is available.110111### Schema112113Schema name: `ImageEditCompletedEvent`114115- `b64_json: string`116117  Base64-encoded final edited image data, suitable for rendering as an image.118119- `background: "transparent" or "opaque" or "auto"`120121  The background setting for the edited image.122123  - `"transparent"`124125  - `"opaque"`126127  - `"auto"`128129- `created_at: number`130131  The Unix timestamp when the event was created.132133- `output_format: "png" or "webp" or "jpeg"`134135  The output format for the edited image.136137  - `"png"`138139  - `"webp"`140141  - `"jpeg"`142143- `quality: "low" or "medium" or "high" or 3 more`144145  The quality setting for the edited image.146147  - `"low"`148149  - `"medium"`150151  - `"high"`152153  - `"xhigh"`154155  - `"max"`156157  - `"auto"`158159- `size: string or "1024x1024" or "1024x1536" or "1536x1024" or "auto"`160161  The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.162163  - `string`164165  - `"1024x1024" or "1024x1536" or "1536x1024" or "auto"`166167    The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.168169    - `"1024x1024"`170171    - `"1024x1536"`172173    - `"1536x1024"`174175    - `"auto"`176177- `type: "image_edit.completed"`178179  The type of the event. Always `image_edit.completed`.180181  - `"image_edit.completed"`182183- `usage: object { input_tokens, input_tokens_details, output_tokens, total_tokens }`184185  For the GPT image models only, the token usage information for the image generation.186187  - `input_tokens: number`188189    The number of tokens (images and text) in the input prompt.190191  - `input_tokens_details: object { image_tokens, text_tokens }`192193    The input tokens detailed information for the image generation.194195    - `image_tokens: number`196197      The number of image tokens in the input prompt.198199    - `text_tokens: number`200201      The number of text tokens in the input prompt.202203  - `output_tokens: number`204205    The number of image tokens in the output image.206207  - `total_tokens: number`208209    The total number of tokens (images and text) used for the image generation.210211### Example212213```json214{215  "type": "image_edit.completed",216  "b64_json": "...",217  "created_at": 1620000000,218  "size": "1024x1024",219  "quality": "high",220  "background": "transparent",221  "output_format": "png",222  "usage": {223    "total_tokens": 100,224    "input_tokens": 50,225    "output_tokens": 50,226    "input_tokens_details": {227      "text_tokens": 10,228      "image_tokens": 40229    }230  }231}232```233
Files main
Menu

Theme