5Stream image generation and editing in real time with server-sent events.5Stream 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).6[Learn more about image streaming](https://developers.openai.com/api/docs/guides/image-generation).
7 7
8<a id="image_generation.partial_image"></a>
9
8## image_generation.partial_image10## image_generation.partial_image
9 11
10Emitted when a partial image is available during image generation streaming.12Emitted when a partial image is available during image generation streaming.
13 15
14Schema name: `ImageGenPartialImageEvent`16Schema name: `ImageGenPartialImageEvent`
15 17
16```json18- `b64_json: string`
17{19
18 "(resource) images > (model) image_gen_partial_image_event > (schema)": {20 Base64-encoded partial image data, suitable for rendering as an image.
19 "kind": "HttpDeclTypeAlias",21
20 "oasRef": "#/components/schemas/ImageGenPartialImageEvent",22- `background: "transparent" or "opaque" or "auto"`
21 "docstring": "Emitted when a partial image is available during image generation streaming.\n",23
22 "ident": "ImageGenPartialImageEvent",24 The background setting for the requested image.
23 "type": {25
24 "kind": "HttpTypeObject",26 - `"transparent"`
25 "members": [27
26 {28 - `"opaque"`
27 "ident": "b64_json"29
28 },30 - `"auto"`
29 {31
30 "ident": "background"32- `created_at: number`
31 },33
32 {34 The Unix timestamp when the event was created.
33 "ident": "created_at"35
34 },36- `output_format: "png" or "webp" or "jpeg"`
35 {37
36 "ident": "output_format"38 The output format for the requested image.
37 },39
38 {40 - `"png"`
39 "ident": "partial_image_index"41
40 },42 - `"webp"`
41 {43
42 "ident": "quality"44 - `"jpeg"`
43 },45
44 {46- `partial_image_index: number`
45 "ident": "size"47
46 },48 0-based index for the partial image (streaming).
47 {49
48 "ident": "type"50- `quality: "low" or "medium" or "high" or 3 more`
49 }51
50 ]52 The quality setting for the requested image.
51 },53
52 "childrenParentSchema": "object",54 - `"low"`
53 "children": [55
54 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) b64_json",56 - `"medium"`
55 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) background",57
56 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) created_at",58 - `"high"`
57 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) output_format",59
58 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) partial_image_index",60 - `"xhigh"`
59 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) quality",61
60 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) size",62 - `"max"`
61 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) type"63
62 ]64 - `"auto"`
63 },65
64 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) b64_json": {66- `size: string or "1024x1024" or "1024x1536" or "1536x1024" or "auto"`
65 "kind": "HttpDeclProperty",67
66 "oasRef": "#/components/schemas/ImageGenPartialImageEvent/properties/b64_json",68 The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.
67 "deprecated": false,69
68 "key": "b64_json",70 - `string`
69 "docstring": "Base64-encoded partial image data, suitable for rendering as an image.\n",71
70 "type": {72 - `"1024x1024" or "1024x1536" or "1536x1024" or "auto"`
71 "kind": "HttpTypeString"73
72 },74 The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.
73 "optional": false,75
74 "nullable": false,76 - `"1024x1024"`
75 "schemaType": "string",77
76 "children": []78 - `"1024x1536"`
77 },79
78 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) background": {80 - `"1536x1024"`
79 "kind": "HttpDeclProperty",81
80 "oasRef": "#/components/schemas/ImageGenPartialImageEvent/properties/background",82 - `"auto"`
81 "deprecated": false,83
82 "key": "background",84- `type: "image_generation.partial_image"`
83 "docstring": "The background setting for the requested image.\n",85
84 "type": {86 The type of the event. Always `image_generation.partial_image`.
85 "kind": "HttpTypeUnion",87
86 "oasRef": "#/components/schemas/ImageGenPartialImageEvent/properties/background",88 - `"image_generation.partial_image"`
87 "types": [
88 {
89 "kind": "HttpTypeLiteral",
90 "literal": "transparent"
91 },
92 {
93 "kind": "HttpTypeLiteral",
94 "literal": "opaque"
95 },
96 {
97 "kind": "HttpTypeLiteral",
98 "literal": "auto"
99 }
100 ]
101 },
102 "optional": false,
103 "nullable": false,
104 "schemaType": "enum",
105 "childrenParentSchema": "enum",
106 "children": [
107 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) background > (member) 0",
108 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) background > (member) 1",
109 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) background > (member) 2"
110 ]
111 },
112 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) created_at": {
113 "kind": "HttpDeclProperty",
114 "oasRef": "#/components/schemas/ImageGenPartialImageEvent/properties/created_at",
115 "deprecated": false,
116 "key": "created_at",
117 "docstring": "The Unix timestamp when the event was created.\n",
118 "type": {
119 "kind": "HttpTypeNumber"
120 },
121 "constraints": {
122 "format": "unixtime"
123 },
124 "optional": false,
125 "nullable": false,
126 "schemaType": "integer",
127 "children": []
128 },
129 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) output_format": {
130 "kind": "HttpDeclProperty",
131 "oasRef": "#/components/schemas/ImageGenPartialImageEvent/properties/output_format",
132 "deprecated": false,
133 "key": "output_format",
134 "docstring": "The output format for the requested image.\n",
135 "type": {
136 "kind": "HttpTypeUnion",
137 "oasRef": "#/components/schemas/ImageGenPartialImageEvent/properties/output_format",
138 "types": [
139 {
140 "kind": "HttpTypeLiteral",
141 "literal": "png"
142 },
143 {
144 "kind": "HttpTypeLiteral",
145 "literal": "webp"
146 },
147 {
148 "kind": "HttpTypeLiteral",
149 "literal": "jpeg"
150 }
151 ]
152 },
153 "optional": false,
154 "nullable": false,
155 "schemaType": "enum",
156 "childrenParentSchema": "enum",
157 "children": [
158 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) output_format > (member) 0",
159 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) output_format > (member) 1",
160 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) output_format > (member) 2"
161 ]
162 },
163 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) partial_image_index": {
164 "kind": "HttpDeclProperty",
165 "oasRef": "#/components/schemas/ImageGenPartialImageEvent/properties/partial_image_index",
166 "deprecated": false,
167 "key": "partial_image_index",
168 "docstring": "0-based index for the partial image (streaming).\n",
169 "type": {
170 "kind": "HttpTypeNumber"
171 },
172 "optional": false,
173 "nullable": false,
174 "schemaType": "integer",
175 "children": []
176 },
177 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) quality": {
178 "kind": "HttpDeclProperty",
179 "oasRef": "#/components/schemas/ImageGenPartialImageEvent/properties/quality",
180 "deprecated": false,
181 "key": "quality",
182 "docstring": "The quality setting for the requested image.\n",
183 "type": {
184 "kind": "HttpTypeUnion",
185 "oasRef": "#/components/schemas/ImageGenPartialImageEvent/properties/quality",
186 "types": [
187 {
188 "kind": "HttpTypeLiteral",
189 "literal": "low"
190 },
191 {
192 "kind": "HttpTypeLiteral",
193 "literal": "medium"
194 },
195 {
196 "kind": "HttpTypeLiteral",
197 "literal": "high"
198 },
199 {
200 "kind": "HttpTypeLiteral",
201 "literal": "xhigh"
202 },
203 {
204 "kind": "HttpTypeLiteral",
205 "literal": "max"
206 },
207 {
208 "kind": "HttpTypeLiteral",
209 "literal": "auto"
210 }
211 ]
212 },
213 "optional": false,
214 "nullable": false,
215 "schemaType": "enum",
216 "childrenParentSchema": "enum",
217 "children": [
218 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) quality > (member) 0",
219 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) quality > (member) 1",
220 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) quality > (member) 2",
221 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) quality > (member) 3",
222 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) quality > (member) 4",
223 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) quality > (member) 5"
224 ]
225 },
226 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) size": {
227 "kind": "HttpDeclProperty",
228 "oasRef": "#/components/schemas/ImageGenPartialImageEvent/properties/size",
229 "deprecated": false,
230 "key": "size",
231 "docstring": "The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.",
232 "type": {
233 "kind": "HttpTypeUnion",
234 "oasRef": "#/components/schemas/ImageGenPartialImageEvent/properties/size",
235 "types": [
236 {
237 "kind": "HttpTypeString"
238 },
239 {
240 "kind": "HttpTypeUnion",
241 "oasRef": "#/components/schemas/ImageGenPartialImageEvent/properties/size/anyOf/1",
242 "types": [
243 {
244 "kind": "HttpTypeLiteral",
245 "literal": "1024x1024"
246 },
247 {
248 "kind": "HttpTypeLiteral",
249 "literal": "1024x1536"
250 },
251 {
252 "kind": "HttpTypeLiteral",
253 "literal": "1536x1024"
254 },
255 {
256 "kind": "HttpTypeLiteral",
257 "literal": "auto"
258 }
259 ]
260 }
261 ]
262 },
263 "optional": false,
264 "nullable": false,
265 "schemaType": "union",
266 "childrenParentSchema": "union",
267 "children": [
268 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) size > (variant) 0",
269 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) size > (variant) 1"
270 ]
271 },
272 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) type": {
273 "kind": "HttpDeclProperty",
274 "oasRef": "#/components/schemas/ImageGenPartialImageEvent/properties/type",
275 "deprecated": false,
276 "key": "type",
277 "docstring": "The type of the event. Always `image_generation.partial_image`.\n",
278 "type": {
279 "kind": "HttpTypeUnion",
280 "oasRef": "#/components/schemas/ImageGenPartialImageEvent/properties/type",
281 "types": [
282 {
283 "kind": "HttpTypeLiteral",
284 "literal": "image_generation.partial_image"
285 }
286 ]
287 },
288 "optional": false,
289 "nullable": false,
290 "schemaType": "enum",
291 "childrenParentSchema": "enum",
292 "children": [
293 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) type > (member) 0"
294 ]
295 },
296 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) background > (member) 0": {
297 "kind": "HttpDeclReference",
298 "type": {
299 "kind": "HttpTypeLiteral",
300 "literal": "transparent"
301 }
302 },
303 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) background > (member) 1": {
304 "kind": "HttpDeclReference",
305 "type": {
306 "kind": "HttpTypeLiteral",
307 "literal": "opaque"
308 }
309 },
310 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) background > (member) 2": {
311 "kind": "HttpDeclReference",
312 "type": {
313 "kind": "HttpTypeLiteral",
314 "literal": "auto"
315 }
316 },
317 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) output_format > (member) 0": {
318 "kind": "HttpDeclReference",
319 "type": {
320 "kind": "HttpTypeLiteral",
321 "literal": "png"
322 }
323 },
324 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) output_format > (member) 1": {
325 "kind": "HttpDeclReference",
326 "type": {
327 "kind": "HttpTypeLiteral",
328 "literal": "webp"
329 }
330 },
331 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) output_format > (member) 2": {
332 "kind": "HttpDeclReference",
333 "type": {
334 "kind": "HttpTypeLiteral",
335 "literal": "jpeg"
336 }
337 },
338 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) quality > (member) 0": {
339 "kind": "HttpDeclReference",
340 "type": {
341 "kind": "HttpTypeLiteral",
342 "literal": "low"
343 }
344 },
345 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) quality > (member) 1": {
346 "kind": "HttpDeclReference",
347 "type": {
348 "kind": "HttpTypeLiteral",
349 "literal": "medium"
350 }
351 },
352 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) quality > (member) 2": {
353 "kind": "HttpDeclReference",
354 "type": {
355 "kind": "HttpTypeLiteral",
356 "literal": "high"
357 }
358 },
359 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) quality > (member) 3": {
360 "kind": "HttpDeclReference",
361 "type": {
362 "kind": "HttpTypeLiteral",
363 "literal": "xhigh"
364 }
365 },
366 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) quality > (member) 4": {
367 "kind": "HttpDeclReference",
368 "type": {
369 "kind": "HttpTypeLiteral",
370 "literal": "max"
371 }
372 },
373 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) quality > (member) 5": {
374 "kind": "HttpDeclReference",
375 "type": {
376 "kind": "HttpTypeLiteral",
377 "literal": "auto"
378 }
379 },
380 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) size > (variant) 0": {
381 "kind": "HttpDeclTypeAlias",
382 "oasRef": "#/components/schemas/ImageGenPartialImageEvent/properties/size/anyOf/0",
383 "ident": "UnionMember0",
384 "type": {
385 "kind": "HttpTypeString"
386 },
387 "children": []
388 },
389 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) size > (variant) 1": {
390 "kind": "HttpDeclTypeAlias",
391 "oasRef": "#/components/schemas/ImageGenPartialImageEvent/properties/size/anyOf/1",
392 "docstring": "The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.",
393 "ident": "UnionMember1",
394 "type": {
395 "kind": "HttpTypeUnion",
396 "oasRef": "#/components/schemas/ImageGenPartialImageEvent/properties/size/anyOf/1",
397 "types": [
398 {
399 "kind": "HttpTypeLiteral",
400 "literal": "1024x1024"
401 },
402 {
403 "kind": "HttpTypeLiteral",
404 "literal": "1024x1536"
405 },
406 {
407 "kind": "HttpTypeLiteral",
408 "literal": "1536x1024"
409 },
410 {
411 "kind": "HttpTypeLiteral",
412 "literal": "auto"
413 }
414 ]
415 },
416 "childrenParentSchema": "enum",
417 "children": [
418 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) size > (variant) 1 > (member) 0",
419 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) size > (variant) 1 > (member) 1",
420 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) size > (variant) 1 > (member) 2",
421 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) size > (variant) 1 > (member) 3"
422 ]
423 },
424 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) type > (member) 0": {
425 "kind": "HttpDeclReference",
426 "type": {
427 "kind": "HttpTypeLiteral",
428 "literal": "image_generation.partial_image"
429 }
430 },
431 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) size > (variant) 1 > (member) 0": {
432 "kind": "HttpDeclReference",
433 "type": {
434 "kind": "HttpTypeLiteral",
435 "literal": "1024x1024"
436 }
437 },
438 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) size > (variant) 1 > (member) 1": {
439 "kind": "HttpDeclReference",
440 "type": {
441 "kind": "HttpTypeLiteral",
442 "literal": "1024x1536"
443 }
444 },
445 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) size > (variant) 1 > (member) 2": {
446 "kind": "HttpDeclReference",
447 "type": {
448 "kind": "HttpTypeLiteral",
449 "literal": "1536x1024"
450 }
451 },
452 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) size > (variant) 1 > (member) 3": {
453 "kind": "HttpDeclReference",
454 "type": {
455 "kind": "HttpTypeLiteral",
456 "literal": "auto"
457 }
458 }
459}
460```
461 89
462### Example90### Example
463 91
474}102}
475```103```
476 104
105<a id="image_generation.completed"></a>
106
477## image_generation.completed107## image_generation.completed
478 108
479Emitted when image generation has completed and the final image is available.109Emitted when image generation has completed and the final image is available.
482 112
483Schema name: `ImageGenCompletedEvent`113Schema name: `ImageGenCompletedEvent`
484 114
485```json115- `b64_json: string`
486{116
487 "(resource) images > (model) image_gen_completed_event > (schema)": {117 Base64-encoded image data, suitable for rendering as an image.
488 "kind": "HttpDeclTypeAlias",118
489 "oasRef": "#/components/schemas/ImageGenCompletedEvent",119- `background: "transparent" or "opaque" or "auto"`
490 "docstring": "Emitted when image generation has completed and the final image is available.\n",120
491 "ident": "ImageGenCompletedEvent",121 The background setting for the generated image.
492 "type": {122
493 "kind": "HttpTypeObject",123 - `"transparent"`
494 "members": [124
495 {125 - `"opaque"`
496 "ident": "b64_json"126
497 },127 - `"auto"`
498 {128
499 "ident": "background"129- `created_at: number`
500 },130
501 {131 The Unix timestamp when the event was created.
502 "ident": "created_at"132
503 },133- `output_format: "png" or "webp" or "jpeg"`
504 {134
505 "ident": "output_format"135 The output format for the generated image.
506 },136
507 {137 - `"png"`
508 "ident": "quality"138
509 },139 - `"webp"`
510 {140
511 "ident": "size"141 - `"jpeg"`
512 },142
513 {143- `quality: "low" or "medium" or "high" or 3 more`
514 "ident": "type"144
515 },145 The quality setting for the generated image.
516 {146
517 "ident": "usage"147 - `"low"`
518 }148
519 ]149 - `"medium"`
520 },150
521 "childrenParentSchema": "object",151 - `"high"`
522 "children": [152
523 "(resource) images > (model) image_gen_completed_event > (schema) > (property) b64_json",153 - `"xhigh"`
524 "(resource) images > (model) image_gen_completed_event > (schema) > (property) background",154
525 "(resource) images > (model) image_gen_completed_event > (schema) > (property) created_at",155 - `"max"`
526 "(resource) images > (model) image_gen_completed_event > (schema) > (property) output_format",156
527 "(resource) images > (model) image_gen_completed_event > (schema) > (property) quality",157 - `"auto"`
528 "(resource) images > (model) image_gen_completed_event > (schema) > (property) size",158
529 "(resource) images > (model) image_gen_completed_event > (schema) > (property) type",159- `size: string or "1024x1024" or "1024x1536" or "1536x1024" or "auto"`
530 "(resource) images > (model) image_gen_completed_event > (schema) > (property) usage"160
531 ]161 The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.
532 },162
533 "(resource) images > (model) image_gen_completed_event > (schema) > (property) b64_json": {163 - `string`
534 "kind": "HttpDeclProperty",164
535 "oasRef": "#/components/schemas/ImageGenCompletedEvent/properties/b64_json",165 - `"1024x1024" or "1024x1536" or "1536x1024" or "auto"`
536 "deprecated": false,166
537 "key": "b64_json",167 The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.
538 "docstring": "Base64-encoded image data, suitable for rendering as an image.\n",168
539 "type": {169 - `"1024x1024"`
540 "kind": "HttpTypeString"170
541 },171 - `"1024x1536"`
542 "optional": false,172
543 "nullable": false,173 - `"1536x1024"`
544 "schemaType": "string",174
545 "children": []175 - `"auto"`
546 },176
547 "(resource) images > (model) image_gen_completed_event > (schema) > (property) background": {177- `type: "image_generation.completed"`
548 "kind": "HttpDeclProperty",178
549 "oasRef": "#/components/schemas/ImageGenCompletedEvent/properties/background",179 The type of the event. Always `image_generation.completed`.
550 "deprecated": false,180
551 "key": "background",181 - `"image_generation.completed"`
552 "docstring": "The background setting for the generated image.\n",182
553 "type": {183- `usage: object { input_tokens, input_tokens_details, output_tokens, total_tokens }`
554 "kind": "HttpTypeUnion",184
555 "oasRef": "#/components/schemas/ImageGenCompletedEvent/properties/background",185 For the GPT image models only, the token usage information for the image generation.
556 "types": [186
557 {187 - `input_tokens: number`
558 "kind": "HttpTypeLiteral",188
559 "literal": "transparent"189 The number of tokens (images and text) in the input prompt.
560 },190
561 {191 - `input_tokens_details: object { image_tokens, text_tokens }`
562 "kind": "HttpTypeLiteral",192
563 "literal": "opaque"193 The input tokens detailed information for the image generation.
564 },194
565 {195 - `image_tokens: number`
566 "kind": "HttpTypeLiteral",196
567 "literal": "auto"197 The number of image tokens in the input prompt.
568 }198
569 ]199 - `text_tokens: number`
570 },200
571 "optional": false,201 The number of text tokens in the input prompt.
572 "nullable": false,202
573 "schemaType": "enum",203 - `output_tokens: number`
574 "childrenParentSchema": "enum",204
575 "children": [205 The number of image tokens in the output image.
576 "(resource) images > (model) image_gen_completed_event > (schema) > (property) background > (member) 0",206
577 "(resource) images > (model) image_gen_completed_event > (schema) > (property) background > (member) 1",207 - `total_tokens: number`
578 "(resource) images > (model) image_gen_completed_event > (schema) > (property) background > (member) 2"208
579 ]209 The total number of tokens (images and text) used for the image generation.
580 },
581 "(resource) images > (model) image_gen_completed_event > (schema) > (property) created_at": {
582 "kind": "HttpDeclProperty",
583 "oasRef": "#/components/schemas/ImageGenCompletedEvent/properties/created_at",
584 "deprecated": false,
585 "key": "created_at",
586 "docstring": "The Unix timestamp when the event was created.\n",
587 "type": {
588 "kind": "HttpTypeNumber"
589 },
590 "constraints": {
591 "format": "unixtime"
592 },
593 "optional": false,
594 "nullable": false,
595 "schemaType": "integer",
596 "children": []
597 },
598 "(resource) images > (model) image_gen_completed_event > (schema) > (property) output_format": {
599 "kind": "HttpDeclProperty",
600 "oasRef": "#/components/schemas/ImageGenCompletedEvent/properties/output_format",
601 "deprecated": false,
602 "key": "output_format",
603 "docstring": "The output format for the generated image.\n",
604 "type": {
605 "kind": "HttpTypeUnion",
606 "oasRef": "#/components/schemas/ImageGenCompletedEvent/properties/output_format",
607 "types": [
608 {
609 "kind": "HttpTypeLiteral",
610 "literal": "png"
611 },
612 {
613 "kind": "HttpTypeLiteral",
614 "literal": "webp"
615 },
616 {
617 "kind": "HttpTypeLiteral",
618 "literal": "jpeg"
619 }
620 ]
621 },
622 "optional": false,
623 "nullable": false,
624 "schemaType": "enum",
625 "childrenParentSchema": "enum",
626 "children": [
627 "(resource) images > (model) image_gen_completed_event > (schema) > (property) output_format > (member) 0",
628 "(resource) images > (model) image_gen_completed_event > (schema) > (property) output_format > (member) 1",
629 "(resource) images > (model) image_gen_completed_event > (schema) > (property) output_format > (member) 2"
630 ]
631 },
632 "(resource) images > (model) image_gen_completed_event > (schema) > (property) quality": {
633 "kind": "HttpDeclProperty",
634 "oasRef": "#/components/schemas/ImageGenCompletedEvent/properties/quality",
635 "deprecated": false,
636 "key": "quality",
637 "docstring": "The quality setting for the generated image.\n",
638 "type": {
639 "kind": "HttpTypeUnion",
640 "oasRef": "#/components/schemas/ImageGenCompletedEvent/properties/quality",
641 "types": [
642 {
643 "kind": "HttpTypeLiteral",
644 "literal": "low"
645 },
646 {
647 "kind": "HttpTypeLiteral",
648 "literal": "medium"
649 },
650 {
651 "kind": "HttpTypeLiteral",
652 "literal": "high"
653 },
654 {
655 "kind": "HttpTypeLiteral",
656 "literal": "xhigh"
657 },
658 {
659 "kind": "HttpTypeLiteral",
660 "literal": "max"
661 },
662 {
663 "kind": "HttpTypeLiteral",
664 "literal": "auto"
665 }
666 ]
667 },
668 "optional": false,
669 "nullable": false,
670 "schemaType": "enum",
671 "childrenParentSchema": "enum",
672 "children": [
673 "(resource) images > (model) image_gen_completed_event > (schema) > (property) quality > (member) 0",
674 "(resource) images > (model) image_gen_completed_event > (schema) > (property) quality > (member) 1",
675 "(resource) images > (model) image_gen_completed_event > (schema) > (property) quality > (member) 2",
676 "(resource) images > (model) image_gen_completed_event > (schema) > (property) quality > (member) 3",
677 "(resource) images > (model) image_gen_completed_event > (schema) > (property) quality > (member) 4",
678 "(resource) images > (model) image_gen_completed_event > (schema) > (property) quality > (member) 5"
679 ]
680 },
681 "(resource) images > (model) image_gen_completed_event > (schema) > (property) size": {
682 "kind": "HttpDeclProperty",
683 "oasRef": "#/components/schemas/ImageGenCompletedEvent/properties/size",
684 "deprecated": false,
685 "key": "size",
686 "docstring": "The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.",
687 "type": {
688 "kind": "HttpTypeUnion",
689 "oasRef": "#/components/schemas/ImageGenCompletedEvent/properties/size",
690 "types": [
691 {
692 "kind": "HttpTypeString"
693 },
694 {
695 "kind": "HttpTypeUnion",
696 "oasRef": "#/components/schemas/ImageGenCompletedEvent/properties/size/anyOf/1",
697 "types": [
698 {
699 "kind": "HttpTypeLiteral",
700 "literal": "1024x1024"
701 },
702 {
703 "kind": "HttpTypeLiteral",
704 "literal": "1024x1536"
705 },
706 {
707 "kind": "HttpTypeLiteral",
708 "literal": "1536x1024"
709 },
710 {
711 "kind": "HttpTypeLiteral",
712 "literal": "auto"
713 }
714 ]
715 }
716 ]
717 },
718 "optional": false,
719 "nullable": false,
720 "schemaType": "union",
721 "childrenParentSchema": "union",
722 "children": [
723 "(resource) images > (model) image_gen_completed_event > (schema) > (property) size > (variant) 0",
724 "(resource) images > (model) image_gen_completed_event > (schema) > (property) size > (variant) 1"
725 ]
726 },
727 "(resource) images > (model) image_gen_completed_event > (schema) > (property) type": {
728 "kind": "HttpDeclProperty",
729 "oasRef": "#/components/schemas/ImageGenCompletedEvent/properties/type",
730 "deprecated": false,
731 "key": "type",
732 "docstring": "The type of the event. Always `image_generation.completed`.\n",
733 "type": {
734 "kind": "HttpTypeUnion",
735 "oasRef": "#/components/schemas/ImageGenCompletedEvent/properties/type",
736 "types": [
737 {
738 "kind": "HttpTypeLiteral",
739 "literal": "image_generation.completed"
740 }
741 ]
742 },
743 "optional": false,
744 "nullable": false,
745 "schemaType": "enum",
746 "childrenParentSchema": "enum",
747 "children": [
748 "(resource) images > (model) image_gen_completed_event > (schema) > (property) type > (member) 0"
749 ]
750 },
751 "(resource) images > (model) image_gen_completed_event > (schema) > (property) usage": {
752 "kind": "HttpDeclProperty",
753 "oasRef": "#/components/schemas/ImageGenCompletedEvent/properties/usage",
754 "deprecated": false,
755 "key": "usage",
756 "docstring": "For the GPT image models only, the token usage information for the image generation.\n",
757 "type": {
758 "kind": "HttpTypeObject",
759 "members": [
760 {
761 "ident": "input_tokens"
762 },
763 {
764 "ident": "input_tokens_details"
765 },
766 {
767 "ident": "output_tokens"
768 },
769 {
770 "ident": "total_tokens"
771 }
772 ]
773 },
774 "optional": false,
775 "nullable": false,
776 "schemaType": "object",
777 "childrenParentSchema": "object",
778 "children": [
779 "(resource) images > (model) image_gen_completed_event > (schema) > (property) usage > (property) input_tokens",
780 "(resource) images > (model) image_gen_completed_event > (schema) > (property) usage > (property) input_tokens_details",
781 "(resource) images > (model) image_gen_completed_event > (schema) > (property) usage > (property) output_tokens",
782 "(resource) images > (model) image_gen_completed_event > (schema) > (property) usage > (property) total_tokens"
783 ]
784 },
785 "(resource) images > (model) image_gen_completed_event > (schema) > (property) background > (member) 0": {
786 "kind": "HttpDeclReference",
787 "type": {
788 "kind": "HttpTypeLiteral",
789 "literal": "transparent"
790 }
791 },
792 "(resource) images > (model) image_gen_completed_event > (schema) > (property) background > (member) 1": {
793 "kind": "HttpDeclReference",
794 "type": {
795 "kind": "HttpTypeLiteral",
796 "literal": "opaque"
797 }
798 },
799 "(resource) images > (model) image_gen_completed_event > (schema) > (property) background > (member) 2": {
800 "kind": "HttpDeclReference",
801 "type": {
802 "kind": "HttpTypeLiteral",
803 "literal": "auto"
804 }
805 },
806 "(resource) images > (model) image_gen_completed_event > (schema) > (property) output_format > (member) 0": {
807 "kind": "HttpDeclReference",
808 "type": {
809 "kind": "HttpTypeLiteral",
810 "literal": "png"
811 }
812 },
813 "(resource) images > (model) image_gen_completed_event > (schema) > (property) output_format > (member) 1": {
814 "kind": "HttpDeclReference",
815 "type": {
816 "kind": "HttpTypeLiteral",
817 "literal": "webp"
818 }
819 },
820 "(resource) images > (model) image_gen_completed_event > (schema) > (property) output_format > (member) 2": {
821 "kind": "HttpDeclReference",
822 "type": {
823 "kind": "HttpTypeLiteral",
824 "literal": "jpeg"
825 }
826 },
827 "(resource) images > (model) image_gen_completed_event > (schema) > (property) quality > (member) 0": {
828 "kind": "HttpDeclReference",
829 "type": {
830 "kind": "HttpTypeLiteral",
831 "literal": "low"
832 }
833 },
834 "(resource) images > (model) image_gen_completed_event > (schema) > (property) quality > (member) 1": {
835 "kind": "HttpDeclReference",
836 "type": {
837 "kind": "HttpTypeLiteral",
838 "literal": "medium"
839 }
840 },
841 "(resource) images > (model) image_gen_completed_event > (schema) > (property) quality > (member) 2": {
842 "kind": "HttpDeclReference",
843 "type": {
844 "kind": "HttpTypeLiteral",
845 "literal": "high"
846 }
847 },
848 "(resource) images > (model) image_gen_completed_event > (schema) > (property) quality > (member) 3": {
849 "kind": "HttpDeclReference",
850 "type": {
851 "kind": "HttpTypeLiteral",
852 "literal": "xhigh"
853 }
854 },
855 "(resource) images > (model) image_gen_completed_event > (schema) > (property) quality > (member) 4": {
856 "kind": "HttpDeclReference",
857 "type": {
858 "kind": "HttpTypeLiteral",
859 "literal": "max"
860 }
861 },
862 "(resource) images > (model) image_gen_completed_event > (schema) > (property) quality > (member) 5": {
863 "kind": "HttpDeclReference",
864 "type": {
865 "kind": "HttpTypeLiteral",
866 "literal": "auto"
867 }
868 },
869 "(resource) images > (model) image_gen_completed_event > (schema) > (property) size > (variant) 0": {
870 "kind": "HttpDeclTypeAlias",
871 "oasRef": "#/components/schemas/ImageGenCompletedEvent/properties/size/anyOf/0",
872 "ident": "UnionMember0",
873 "type": {
874 "kind": "HttpTypeString"
875 },
876 "children": []
877 },
878 "(resource) images > (model) image_gen_completed_event > (schema) > (property) size > (variant) 1": {
879 "kind": "HttpDeclTypeAlias",
880 "oasRef": "#/components/schemas/ImageGenCompletedEvent/properties/size/anyOf/1",
881 "docstring": "The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.",
882 "ident": "UnionMember1",
883 "type": {
884 "kind": "HttpTypeUnion",
885 "oasRef": "#/components/schemas/ImageGenCompletedEvent/properties/size/anyOf/1",
886 "types": [
887 {
888 "kind": "HttpTypeLiteral",
889 "literal": "1024x1024"
890 },
891 {
892 "kind": "HttpTypeLiteral",
893 "literal": "1024x1536"
894 },
895 {
896 "kind": "HttpTypeLiteral",
897 "literal": "1536x1024"
898 },
899 {
900 "kind": "HttpTypeLiteral",
901 "literal": "auto"
902 }
903 ]
904 },
905 "childrenParentSchema": "enum",
906 "children": [
907 "(resource) images > (model) image_gen_completed_event > (schema) > (property) size > (variant) 1 > (member) 0",
908 "(resource) images > (model) image_gen_completed_event > (schema) > (property) size > (variant) 1 > (member) 1",
909 "(resource) images > (model) image_gen_completed_event > (schema) > (property) size > (variant) 1 > (member) 2",
910 "(resource) images > (model) image_gen_completed_event > (schema) > (property) size > (variant) 1 > (member) 3"
911 ]
912 },
913 "(resource) images > (model) image_gen_completed_event > (schema) > (property) type > (member) 0": {
914 "kind": "HttpDeclReference",
915 "type": {
916 "kind": "HttpTypeLiteral",
917 "literal": "image_generation.completed"
918 }
919 },
920 "(resource) images > (model) image_gen_completed_event > (schema) > (property) usage > (property) input_tokens": {
921 "kind": "HttpDeclProperty",
922 "oasRef": "#/components/schemas/ImagesUsage/properties/input_tokens",
923 "deprecated": false,
924 "key": "input_tokens",
925 "docstring": "The number of tokens (images and text) in the input prompt.",
926 "type": {
927 "kind": "HttpTypeNumber"
928 },
929 "optional": false,
930 "nullable": false,
931 "schemaType": "integer",
932 "children": []
933 },
934 "(resource) images > (model) image_gen_completed_event > (schema) > (property) usage > (property) input_tokens_details": {
935 "kind": "HttpDeclProperty",
936 "oasRef": "#/components/schemas/ImagesUsage/properties/input_tokens_details",
937 "deprecated": false,
938 "key": "input_tokens_details",
939 "docstring": "The input tokens detailed information for the image generation.",
940 "type": {
941 "kind": "HttpTypeObject",
942 "members": [
943 {
944 "ident": "image_tokens"
945 },
946 {
947 "ident": "text_tokens"
948 }
949 ]
950 },
951 "optional": false,
952 "nullable": false,
953 "schemaType": "object",
954 "childrenParentSchema": "object",
955 "children": [
956 "(resource) images > (model) image_gen_completed_event > (schema) > (property) usage > (property) input_tokens_details > (property) image_tokens",
957 "(resource) images > (model) image_gen_completed_event > (schema) > (property) usage > (property) input_tokens_details > (property) text_tokens"
958 ]
959 },
960 "(resource) images > (model) image_gen_completed_event > (schema) > (property) usage > (property) output_tokens": {
961 "kind": "HttpDeclProperty",
962 "oasRef": "#/components/schemas/ImagesUsage/properties/output_tokens",
963 "deprecated": false,
964 "key": "output_tokens",
965 "docstring": "The number of image tokens in the output image.",
966 "type": {
967 "kind": "HttpTypeNumber"
968 },
969 "optional": false,
970 "nullable": false,
971 "schemaType": "integer",
972 "children": []
973 },
974 "(resource) images > (model) image_gen_completed_event > (schema) > (property) usage > (property) total_tokens": {
975 "kind": "HttpDeclProperty",
976 "oasRef": "#/components/schemas/ImagesUsage/properties/total_tokens",
977 "deprecated": false,
978 "key": "total_tokens",
979 "docstring": "The total number of tokens (images and text) used for the image generation.\n",
980 "type": {
981 "kind": "HttpTypeNumber"
982 },
983 "optional": false,
984 "nullable": false,
985 "schemaType": "integer",
986 "children": []
987 },
988 "(resource) images > (model) image_gen_completed_event > (schema) > (property) size > (variant) 1 > (member) 0": {
989 "kind": "HttpDeclReference",
990 "type": {
991 "kind": "HttpTypeLiteral",
992 "literal": "1024x1024"
993 }
994 },
995 "(resource) images > (model) image_gen_completed_event > (schema) > (property) size > (variant) 1 > (member) 1": {
996 "kind": "HttpDeclReference",
997 "type": {
998 "kind": "HttpTypeLiteral",
999 "literal": "1024x1536"
1000 }
1001 },
1002 "(resource) images > (model) image_gen_completed_event > (schema) > (property) size > (variant) 1 > (member) 2": {
1003 "kind": "HttpDeclReference",
1004 "type": {
1005 "kind": "HttpTypeLiteral",
1006 "literal": "1536x1024"
1007 }
1008 },
1009 "(resource) images > (model) image_gen_completed_event > (schema) > (property) size > (variant) 1 > (member) 3": {
1010 "kind": "HttpDeclReference",
1011 "type": {
1012 "kind": "HttpTypeLiteral",
1013 "literal": "auto"
1014 }
1015 },
1016 "(resource) images > (model) image_gen_completed_event > (schema) > (property) usage > (property) input_tokens_details > (property) image_tokens": {
1017 "kind": "HttpDeclProperty",
1018 "oasRef": "#/components/schemas/ImagesUsage/properties/input_tokens_details/properties/image_tokens",
1019 "deprecated": false,
1020 "key": "image_tokens",
1021 "docstring": "The number of image tokens in the input prompt.",
1022 "type": {
1023 "kind": "HttpTypeNumber"
1024 },
1025 "optional": false,
1026 "nullable": false,
1027 "schemaType": "integer",
1028 "children": []
1029 },
1030 "(resource) images > (model) image_gen_completed_event > (schema) > (property) usage > (property) input_tokens_details > (property) text_tokens": {
1031 "kind": "HttpDeclProperty",
1032 "oasRef": "#/components/schemas/ImagesUsage/properties/input_tokens_details/properties/text_tokens",
1033 "deprecated": false,
1034 "key": "text_tokens",
1035 "docstring": "The number of text tokens in the input prompt.",
1036 "type": {
1037 "kind": "HttpTypeNumber"
1038 },
1039 "optional": false,
1040 "nullable": false,
1041 "schemaType": "integer",
1042 "children": []
1043 }
1044}
1045```
1046 210
1047### Example211### Example
1048 212