images.d.mts 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678
  1. import { APIResource } from "../core/resource.mjs";
  2. import * as ImagesAPI from "./images.mjs";
  3. import { APIPromise } from "../core/api-promise.mjs";
  4. import { Stream } from "../core/streaming.mjs";
  5. import { type Uploadable } from "../core/uploads.mjs";
  6. import { RequestOptions } from "../internal/request-options.mjs";
  7. export declare class Images extends APIResource {
  8. /**
  9. * Creates a variation of a given image. This endpoint only supports `dall-e-2`.
  10. *
  11. * @example
  12. * ```ts
  13. * const imagesResponse = await client.images.createVariation({
  14. * image: fs.createReadStream('otter.png'),
  15. * });
  16. * ```
  17. */
  18. createVariation(body: ImageCreateVariationParams, options?: RequestOptions): APIPromise<ImagesResponse>;
  19. /**
  20. * Creates an edited or extended image given one or more source images and a
  21. * prompt. This endpoint supports GPT Image models (`gpt-image-1.5`, `gpt-image-1`,
  22. * and `gpt-image-1-mini`) and `dall-e-2`.
  23. *
  24. * @example
  25. * ```ts
  26. * const imagesResponse = await client.images.edit({
  27. * image: fs.createReadStream('path/to/file'),
  28. * prompt: 'A cute baby sea otter wearing a beret',
  29. * });
  30. * ```
  31. */
  32. edit(body: ImageEditParamsNonStreaming, options?: RequestOptions): APIPromise<ImagesResponse>;
  33. edit(body: ImageEditParamsStreaming, options?: RequestOptions): APIPromise<Stream<ImageEditStreamEvent>>;
  34. edit(body: ImageEditParamsBase, options?: RequestOptions): APIPromise<Stream<ImageEditStreamEvent> | ImagesResponse>;
  35. /**
  36. * Creates an image given a prompt.
  37. * [Learn more](https://platform.openai.com/docs/guides/images).
  38. *
  39. * @example
  40. * ```ts
  41. * const imagesResponse = await client.images.generate({
  42. * prompt: 'A cute baby sea otter',
  43. * });
  44. * ```
  45. */
  46. generate(body: ImageGenerateParamsNonStreaming, options?: RequestOptions): APIPromise<ImagesResponse>;
  47. generate(body: ImageGenerateParamsStreaming, options?: RequestOptions): APIPromise<Stream<ImageGenStreamEvent>>;
  48. generate(body: ImageGenerateParamsBase, options?: RequestOptions): APIPromise<Stream<ImageGenStreamEvent> | ImagesResponse>;
  49. }
  50. /**
  51. * Represents the content or the URL of an image generated by the OpenAI API.
  52. */
  53. export interface Image {
  54. /**
  55. * The base64-encoded JSON of the generated image. Returned by default for the GPT
  56. * image models, and only present if `response_format` is set to `b64_json` for
  57. * `dall-e-2` and `dall-e-3`.
  58. */
  59. b64_json?: string;
  60. /**
  61. * For `dall-e-3` only, the revised prompt that was used to generate the image.
  62. */
  63. revised_prompt?: string;
  64. /**
  65. * When using `dall-e-2` or `dall-e-3`, the URL of the generated image if
  66. * `response_format` is set to `url` (default value). Unsupported for the GPT image
  67. * models.
  68. */
  69. url?: string;
  70. }
  71. /**
  72. * Emitted when image editing has completed and the final image is available.
  73. */
  74. export interface ImageEditCompletedEvent {
  75. /**
  76. * Base64-encoded final edited image data, suitable for rendering as an image.
  77. */
  78. b64_json: string;
  79. /**
  80. * The background setting for the edited image.
  81. */
  82. background: 'transparent' | 'opaque' | 'auto';
  83. /**
  84. * The Unix timestamp when the event was created.
  85. */
  86. created_at: number;
  87. /**
  88. * The output format for the edited image.
  89. */
  90. output_format: 'png' | 'webp' | 'jpeg';
  91. /**
  92. * The quality setting for the edited image.
  93. */
  94. quality: 'low' | 'medium' | 'high' | 'auto';
  95. /**
  96. * The size of the edited image.
  97. */
  98. size: '1024x1024' | '1024x1536' | '1536x1024' | 'auto';
  99. /**
  100. * The type of the event. Always `image_edit.completed`.
  101. */
  102. type: 'image_edit.completed';
  103. /**
  104. * For the GPT image models only, the token usage information for the image
  105. * generation.
  106. */
  107. usage: ImageEditCompletedEvent.Usage;
  108. }
  109. export declare namespace ImageEditCompletedEvent {
  110. /**
  111. * For the GPT image models only, the token usage information for the image
  112. * generation.
  113. */
  114. interface Usage {
  115. /**
  116. * The number of tokens (images and text) in the input prompt.
  117. */
  118. input_tokens: number;
  119. /**
  120. * The input tokens detailed information for the image generation.
  121. */
  122. input_tokens_details: Usage.InputTokensDetails;
  123. /**
  124. * The number of image tokens in the output image.
  125. */
  126. output_tokens: number;
  127. /**
  128. * The total number of tokens (images and text) used for the image generation.
  129. */
  130. total_tokens: number;
  131. }
  132. namespace Usage {
  133. /**
  134. * The input tokens detailed information for the image generation.
  135. */
  136. interface InputTokensDetails {
  137. /**
  138. * The number of image tokens in the input prompt.
  139. */
  140. image_tokens: number;
  141. /**
  142. * The number of text tokens in the input prompt.
  143. */
  144. text_tokens: number;
  145. }
  146. }
  147. }
  148. /**
  149. * Emitted when a partial image is available during image editing streaming.
  150. */
  151. export interface ImageEditPartialImageEvent {
  152. /**
  153. * Base64-encoded partial image data, suitable for rendering as an image.
  154. */
  155. b64_json: string;
  156. /**
  157. * The background setting for the requested edited image.
  158. */
  159. background: 'transparent' | 'opaque' | 'auto';
  160. /**
  161. * The Unix timestamp when the event was created.
  162. */
  163. created_at: number;
  164. /**
  165. * The output format for the requested edited image.
  166. */
  167. output_format: 'png' | 'webp' | 'jpeg';
  168. /**
  169. * 0-based index for the partial image (streaming).
  170. */
  171. partial_image_index: number;
  172. /**
  173. * The quality setting for the requested edited image.
  174. */
  175. quality: 'low' | 'medium' | 'high' | 'auto';
  176. /**
  177. * The size of the requested edited image.
  178. */
  179. size: '1024x1024' | '1024x1536' | '1536x1024' | 'auto';
  180. /**
  181. * The type of the event. Always `image_edit.partial_image`.
  182. */
  183. type: 'image_edit.partial_image';
  184. }
  185. /**
  186. * Emitted when a partial image is available during image editing streaming.
  187. */
  188. export type ImageEditStreamEvent = ImageEditPartialImageEvent | ImageEditCompletedEvent;
  189. /**
  190. * Emitted when image generation has completed and the final image is available.
  191. */
  192. export interface ImageGenCompletedEvent {
  193. /**
  194. * Base64-encoded image data, suitable for rendering as an image.
  195. */
  196. b64_json: string;
  197. /**
  198. * The background setting for the generated image.
  199. */
  200. background: 'transparent' | 'opaque' | 'auto';
  201. /**
  202. * The Unix timestamp when the event was created.
  203. */
  204. created_at: number;
  205. /**
  206. * The output format for the generated image.
  207. */
  208. output_format: 'png' | 'webp' | 'jpeg';
  209. /**
  210. * The quality setting for the generated image.
  211. */
  212. quality: 'low' | 'medium' | 'high' | 'auto';
  213. /**
  214. * The size of the generated image.
  215. */
  216. size: '1024x1024' | '1024x1536' | '1536x1024' | 'auto';
  217. /**
  218. * The type of the event. Always `image_generation.completed`.
  219. */
  220. type: 'image_generation.completed';
  221. /**
  222. * For the GPT image models only, the token usage information for the image
  223. * generation.
  224. */
  225. usage: ImageGenCompletedEvent.Usage;
  226. }
  227. export declare namespace ImageGenCompletedEvent {
  228. /**
  229. * For the GPT image models only, the token usage information for the image
  230. * generation.
  231. */
  232. interface Usage {
  233. /**
  234. * The number of tokens (images and text) in the input prompt.
  235. */
  236. input_tokens: number;
  237. /**
  238. * The input tokens detailed information for the image generation.
  239. */
  240. input_tokens_details: Usage.InputTokensDetails;
  241. /**
  242. * The number of image tokens in the output image.
  243. */
  244. output_tokens: number;
  245. /**
  246. * The total number of tokens (images and text) used for the image generation.
  247. */
  248. total_tokens: number;
  249. }
  250. namespace Usage {
  251. /**
  252. * The input tokens detailed information for the image generation.
  253. */
  254. interface InputTokensDetails {
  255. /**
  256. * The number of image tokens in the input prompt.
  257. */
  258. image_tokens: number;
  259. /**
  260. * The number of text tokens in the input prompt.
  261. */
  262. text_tokens: number;
  263. }
  264. }
  265. }
  266. /**
  267. * Emitted when a partial image is available during image generation streaming.
  268. */
  269. export interface ImageGenPartialImageEvent {
  270. /**
  271. * Base64-encoded partial image data, suitable for rendering as an image.
  272. */
  273. b64_json: string;
  274. /**
  275. * The background setting for the requested image.
  276. */
  277. background: 'transparent' | 'opaque' | 'auto';
  278. /**
  279. * The Unix timestamp when the event was created.
  280. */
  281. created_at: number;
  282. /**
  283. * The output format for the requested image.
  284. */
  285. output_format: 'png' | 'webp' | 'jpeg';
  286. /**
  287. * 0-based index for the partial image (streaming).
  288. */
  289. partial_image_index: number;
  290. /**
  291. * The quality setting for the requested image.
  292. */
  293. quality: 'low' | 'medium' | 'high' | 'auto';
  294. /**
  295. * The size of the requested image.
  296. */
  297. size: '1024x1024' | '1024x1536' | '1536x1024' | 'auto';
  298. /**
  299. * The type of the event. Always `image_generation.partial_image`.
  300. */
  301. type: 'image_generation.partial_image';
  302. }
  303. /**
  304. * Emitted when a partial image is available during image generation streaming.
  305. */
  306. export type ImageGenStreamEvent = ImageGenPartialImageEvent | ImageGenCompletedEvent;
  307. export type ImageModel = 'gpt-image-1.5' | 'dall-e-2' | 'dall-e-3' | 'gpt-image-1' | 'gpt-image-1-mini';
  308. /**
  309. * The response from the image generation endpoint.
  310. */
  311. export interface ImagesResponse {
  312. /**
  313. * The Unix timestamp (in seconds) of when the image was created.
  314. */
  315. created: number;
  316. /**
  317. * The background parameter used for the image generation. Either `transparent` or
  318. * `opaque`.
  319. */
  320. background?: 'transparent' | 'opaque';
  321. /**
  322. * The list of generated images.
  323. */
  324. data?: Array<Image>;
  325. /**
  326. * The output format of the image generation. Either `png`, `webp`, or `jpeg`.
  327. */
  328. output_format?: 'png' | 'webp' | 'jpeg';
  329. /**
  330. * The quality of the image generated. Either `low`, `medium`, or `high`.
  331. */
  332. quality?: 'low' | 'medium' | 'high';
  333. /**
  334. * The size of the image generated. Either `1024x1024`, `1024x1536`, or
  335. * `1536x1024`.
  336. */
  337. size?: '1024x1024' | '1024x1536' | '1536x1024';
  338. /**
  339. * For `gpt-image-1` only, the token usage information for the image generation.
  340. */
  341. usage?: ImagesResponse.Usage;
  342. }
  343. export declare namespace ImagesResponse {
  344. /**
  345. * For `gpt-image-1` only, the token usage information for the image generation.
  346. */
  347. interface Usage {
  348. /**
  349. * The number of tokens (images and text) in the input prompt.
  350. */
  351. input_tokens: number;
  352. /**
  353. * The input tokens detailed information for the image generation.
  354. */
  355. input_tokens_details: Usage.InputTokensDetails;
  356. /**
  357. * The number of output tokens generated by the model.
  358. */
  359. output_tokens: number;
  360. /**
  361. * The total number of tokens (images and text) used for the image generation.
  362. */
  363. total_tokens: number;
  364. /**
  365. * The output token details for the image generation.
  366. */
  367. output_tokens_details?: Usage.OutputTokensDetails;
  368. }
  369. namespace Usage {
  370. /**
  371. * The input tokens detailed information for the image generation.
  372. */
  373. interface InputTokensDetails {
  374. /**
  375. * The number of image tokens in the input prompt.
  376. */
  377. image_tokens: number;
  378. /**
  379. * The number of text tokens in the input prompt.
  380. */
  381. text_tokens: number;
  382. }
  383. /**
  384. * The output token details for the image generation.
  385. */
  386. interface OutputTokensDetails {
  387. /**
  388. * The number of image output tokens generated by the model.
  389. */
  390. image_tokens: number;
  391. /**
  392. * The number of text output tokens generated by the model.
  393. */
  394. text_tokens: number;
  395. }
  396. }
  397. }
  398. export interface ImageCreateVariationParams {
  399. /**
  400. * The image to use as the basis for the variation(s). Must be a valid PNG file,
  401. * less than 4MB, and square.
  402. */
  403. image: Uploadable;
  404. /**
  405. * The model to use for image generation. Only `dall-e-2` is supported at this
  406. * time.
  407. */
  408. model?: (string & {}) | ImageModel | null;
  409. /**
  410. * The number of images to generate. Must be between 1 and 10.
  411. */
  412. n?: number | null;
  413. /**
  414. * The format in which the generated images are returned. Must be one of `url` or
  415. * `b64_json`. URLs are only valid for 60 minutes after the image has been
  416. * generated.
  417. */
  418. response_format?: 'url' | 'b64_json' | null;
  419. /**
  420. * The size of the generated images. Must be one of `256x256`, `512x512`, or
  421. * `1024x1024`.
  422. */
  423. size?: '256x256' | '512x512' | '1024x1024' | null;
  424. /**
  425. * A unique identifier representing your end-user, which can help OpenAI to monitor
  426. * and detect abuse.
  427. * [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#end-user-ids).
  428. */
  429. user?: string;
  430. }
  431. export type ImageEditParams = ImageEditParamsNonStreaming | ImageEditParamsStreaming;
  432. export interface ImageEditParamsBase {
  433. /**
  434. * The image(s) to edit. Must be a supported image file or an array of images.
  435. *
  436. * For the GPT image models (`gpt-image-1`, `gpt-image-1-mini`, and
  437. * `gpt-image-1.5`), each image should be a `png`, `webp`, or `jpg` file less than
  438. * 50MB. You can provide up to 16 images.
  439. *
  440. * For `dall-e-2`, you can only provide one image, and it should be a square `png`
  441. * file less than 4MB.
  442. */
  443. image: Uploadable | Array<Uploadable>;
  444. /**
  445. * A text description of the desired image(s). The maximum length is 1000
  446. * characters for `dall-e-2`, and 32000 characters for the GPT image models.
  447. */
  448. prompt: string;
  449. /**
  450. * Allows to set transparency for the background of the generated image(s). This
  451. * parameter is only supported for the GPT image models. Must be one of
  452. * `transparent`, `opaque` or `auto` (default value). When `auto` is used, the
  453. * model will automatically determine the best background for the image.
  454. *
  455. * If `transparent`, the output format needs to support transparency, so it should
  456. * be set to either `png` (default value) or `webp`.
  457. */
  458. background?: 'transparent' | 'opaque' | 'auto' | null;
  459. /**
  460. * Control how much effort the model will exert to match the style and features,
  461. * especially facial features, of input images. This parameter is only supported
  462. * for `gpt-image-1`. Unsupported for `gpt-image-1-mini`. Supports `high` and
  463. * `low`. Defaults to `low`.
  464. */
  465. input_fidelity?: 'high' | 'low' | null;
  466. /**
  467. * An additional image whose fully transparent areas (e.g. where alpha is zero)
  468. * indicate where `image` should be edited. If there are multiple images provided,
  469. * the mask will be applied on the first image. Must be a valid PNG file, less than
  470. * 4MB, and have the same dimensions as `image`.
  471. */
  472. mask?: Uploadable;
  473. /**
  474. * The model to use for image generation. Only `dall-e-2` and the GPT image models
  475. * are supported. Defaults to `dall-e-2` unless a parameter specific to the GPT
  476. * image models is used.
  477. */
  478. model?: (string & {}) | ImageModel | null;
  479. /**
  480. * The number of images to generate. Must be between 1 and 10.
  481. */
  482. n?: number | null;
  483. /**
  484. * The compression level (0-100%) for the generated images. This parameter is only
  485. * supported for the GPT image models with the `webp` or `jpeg` output formats, and
  486. * defaults to 100.
  487. */
  488. output_compression?: number | null;
  489. /**
  490. * The format in which the generated images are returned. This parameter is only
  491. * supported for the GPT image models. Must be one of `png`, `jpeg`, or `webp`. The
  492. * default value is `png`.
  493. */
  494. output_format?: 'png' | 'jpeg' | 'webp' | null;
  495. /**
  496. * The number of partial images to generate. This parameter is used for streaming
  497. * responses that return partial images. Value must be between 0 and 3. When set to
  498. * 0, the response will be a single image sent in one streaming event.
  499. *
  500. * Note that the final image may be sent before the full number of partial images
  501. * are generated if the full image is generated more quickly.
  502. */
  503. partial_images?: number | null;
  504. /**
  505. * The quality of the image that will be generated. `high`, `medium` and `low` are
  506. * only supported for the GPT image models. `dall-e-2` only supports `standard`
  507. * quality. Defaults to `auto`.
  508. */
  509. quality?: 'standard' | 'low' | 'medium' | 'high' | 'auto' | null;
  510. /**
  511. * The format in which the generated images are returned. Must be one of `url` or
  512. * `b64_json`. URLs are only valid for 60 minutes after the image has been
  513. * generated. This parameter is only supported for `dall-e-2`, as the GPT image
  514. * models always return base64-encoded images.
  515. */
  516. response_format?: 'url' | 'b64_json' | null;
  517. /**
  518. * The size of the generated images. Must be one of `1024x1024`, `1536x1024`
  519. * (landscape), `1024x1536` (portrait), or `auto` (default value) for the GPT image
  520. * models, and one of `256x256`, `512x512`, or `1024x1024` for `dall-e-2`.
  521. */
  522. size?: '256x256' | '512x512' | '1024x1024' | '1536x1024' | '1024x1536' | 'auto' | null;
  523. /**
  524. * Edit the image in streaming mode. Defaults to `false`. See the
  525. * [Image generation guide](https://platform.openai.com/docs/guides/image-generation)
  526. * for more information.
  527. */
  528. stream?: boolean | null;
  529. /**
  530. * A unique identifier representing your end-user, which can help OpenAI to monitor
  531. * and detect abuse.
  532. * [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#end-user-ids).
  533. */
  534. user?: string;
  535. }
  536. export declare namespace ImageEditParams {
  537. type ImageEditParamsNonStreaming = ImagesAPI.ImageEditParamsNonStreaming;
  538. type ImageEditParamsStreaming = ImagesAPI.ImageEditParamsStreaming;
  539. }
  540. export interface ImageEditParamsNonStreaming extends ImageEditParamsBase {
  541. /**
  542. * Edit the image in streaming mode. Defaults to `false`. See the
  543. * [Image generation guide](https://platform.openai.com/docs/guides/image-generation)
  544. * for more information.
  545. */
  546. stream?: false | null;
  547. }
  548. export interface ImageEditParamsStreaming extends ImageEditParamsBase {
  549. /**
  550. * Edit the image in streaming mode. Defaults to `false`. See the
  551. * [Image generation guide](https://platform.openai.com/docs/guides/image-generation)
  552. * for more information.
  553. */
  554. stream: true;
  555. }
  556. export type ImageGenerateParams = ImageGenerateParamsNonStreaming | ImageGenerateParamsStreaming;
  557. export interface ImageGenerateParamsBase {
  558. /**
  559. * A text description of the desired image(s). The maximum length is 32000
  560. * characters for the GPT image models, 1000 characters for `dall-e-2` and 4000
  561. * characters for `dall-e-3`.
  562. */
  563. prompt: string;
  564. /**
  565. * Allows to set transparency for the background of the generated image(s). This
  566. * parameter is only supported for the GPT image models. Must be one of
  567. * `transparent`, `opaque` or `auto` (default value). When `auto` is used, the
  568. * model will automatically determine the best background for the image.
  569. *
  570. * If `transparent`, the output format needs to support transparency, so it should
  571. * be set to either `png` (default value) or `webp`.
  572. */
  573. background?: 'transparent' | 'opaque' | 'auto' | null;
  574. /**
  575. * The model to use for image generation. One of `dall-e-2`, `dall-e-3`, or a GPT
  576. * image model (`gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`). Defaults to
  577. * `dall-e-2` unless a parameter specific to the GPT image models is used.
  578. */
  579. model?: (string & {}) | ImageModel | null;
  580. /**
  581. * Control the content-moderation level for images generated by the GPT image
  582. * models. Must be either `low` for less restrictive filtering or `auto` (default
  583. * value).
  584. */
  585. moderation?: 'low' | 'auto' | null;
  586. /**
  587. * The number of images to generate. Must be between 1 and 10. For `dall-e-3`, only
  588. * `n=1` is supported.
  589. */
  590. n?: number | null;
  591. /**
  592. * The compression level (0-100%) for the generated images. This parameter is only
  593. * supported for the GPT image models with the `webp` or `jpeg` output formats, and
  594. * defaults to 100.
  595. */
  596. output_compression?: number | null;
  597. /**
  598. * The format in which the generated images are returned. This parameter is only
  599. * supported for the GPT image models. Must be one of `png`, `jpeg`, or `webp`.
  600. */
  601. output_format?: 'png' | 'jpeg' | 'webp' | null;
  602. /**
  603. * The number of partial images to generate. This parameter is used for streaming
  604. * responses that return partial images. Value must be between 0 and 3. When set to
  605. * 0, the response will be a single image sent in one streaming event.
  606. *
  607. * Note that the final image may be sent before the full number of partial images
  608. * are generated if the full image is generated more quickly.
  609. */
  610. partial_images?: number | null;
  611. /**
  612. * The quality of the image that will be generated.
  613. *
  614. * - `auto` (default value) will automatically select the best quality for the
  615. * given model.
  616. * - `high`, `medium` and `low` are supported for the GPT image models.
  617. * - `hd` and `standard` are supported for `dall-e-3`.
  618. * - `standard` is the only option for `dall-e-2`.
  619. */
  620. quality?: 'standard' | 'hd' | 'low' | 'medium' | 'high' | 'auto' | null;
  621. /**
  622. * The format in which generated images with `dall-e-2` and `dall-e-3` are
  623. * returned. Must be one of `url` or `b64_json`. URLs are only valid for 60 minutes
  624. * after the image has been generated. This parameter isn't supported for the GPT
  625. * image models, which always return base64-encoded images.
  626. */
  627. response_format?: 'url' | 'b64_json' | null;
  628. /**
  629. * The size of the generated images. Must be one of `1024x1024`, `1536x1024`
  630. * (landscape), `1024x1536` (portrait), or `auto` (default value) for the GPT image
  631. * models, one of `256x256`, `512x512`, or `1024x1024` for `dall-e-2`, and one of
  632. * `1024x1024`, `1792x1024`, or `1024x1792` for `dall-e-3`.
  633. */
  634. size?: 'auto' | '1024x1024' | '1536x1024' | '1024x1536' | '256x256' | '512x512' | '1792x1024' | '1024x1792' | null;
  635. /**
  636. * Generate the image in streaming mode. Defaults to `false`. See the
  637. * [Image generation guide](https://platform.openai.com/docs/guides/image-generation)
  638. * for more information. This parameter is only supported for the GPT image models.
  639. */
  640. stream?: boolean | null;
  641. /**
  642. * The style of the generated images. This parameter is only supported for
  643. * `dall-e-3`. Must be one of `vivid` or `natural`. Vivid causes the model to lean
  644. * towards generating hyper-real and dramatic images. Natural causes the model to
  645. * produce more natural, less hyper-real looking images.
  646. */
  647. style?: 'vivid' | 'natural' | null;
  648. /**
  649. * A unique identifier representing your end-user, which can help OpenAI to monitor
  650. * and detect abuse.
  651. * [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#end-user-ids).
  652. */
  653. user?: string;
  654. }
  655. export declare namespace ImageGenerateParams {
  656. type ImageGenerateParamsNonStreaming = ImagesAPI.ImageGenerateParamsNonStreaming;
  657. type ImageGenerateParamsStreaming = ImagesAPI.ImageGenerateParamsStreaming;
  658. }
  659. export interface ImageGenerateParamsNonStreaming extends ImageGenerateParamsBase {
  660. /**
  661. * Generate the image in streaming mode. Defaults to `false`. See the
  662. * [Image generation guide](https://platform.openai.com/docs/guides/image-generation)
  663. * for more information. This parameter is only supported for the GPT image models.
  664. */
  665. stream?: false | null;
  666. }
  667. export interface ImageGenerateParamsStreaming extends ImageGenerateParamsBase {
  668. /**
  669. * Generate the image in streaming mode. Defaults to `false`. See the
  670. * [Image generation guide](https://platform.openai.com/docs/guides/image-generation)
  671. * for more information. This parameter is only supported for the GPT image models.
  672. */
  673. stream: true;
  674. }
  675. export declare namespace Images {
  676. export { type Image as Image, type ImageEditCompletedEvent as ImageEditCompletedEvent, type ImageEditPartialImageEvent as ImageEditPartialImageEvent, type ImageEditStreamEvent as ImageEditStreamEvent, type ImageGenCompletedEvent as ImageGenCompletedEvent, type ImageGenPartialImageEvent as ImageGenPartialImageEvent, type ImageGenStreamEvent as ImageGenStreamEvent, type ImageModel as ImageModel, type ImagesResponse as ImagesResponse, type ImageCreateVariationParams as ImageCreateVariationParams, type ImageEditParams as ImageEditParams, type ImageEditParamsNonStreaming as ImageEditParamsNonStreaming, type ImageEditParamsStreaming as ImageEditParamsStreaming, type ImageGenerateParams as ImageGenerateParams, type ImageGenerateParamsNonStreaming as ImageGenerateParamsNonStreaming, type ImageGenerateParamsStreaming as ImageGenerateParamsStreaming, };
  677. }
  678. //# sourceMappingURL=images.d.mts.map