|
| 1 | +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. |
| 2 | + |
| 3 | +import { APIResource } from '../resource'; |
| 4 | +import * as Core from '../core'; |
| 5 | + |
| 6 | +export class TextToImage extends APIResource { |
| 7 | + /** |
| 8 | + * This endpoint will start a new task to generate images from text. |
| 9 | + */ |
| 10 | + create( |
| 11 | + body: TextToImageCreateParams, |
| 12 | + options?: Core.RequestOptions, |
| 13 | + ): Core.APIPromise<TextToImageCreateResponse> { |
| 14 | + return this._client.post('/v1/text_to_image', { body, ...options }); |
| 15 | + } |
| 16 | +} |
| 17 | + |
| 18 | +export interface TextToImageCreateResponse { |
| 19 | + /** |
| 20 | + * The ID of the newly created task. |
| 21 | + */ |
| 22 | + id: string; |
| 23 | +} |
| 24 | + |
| 25 | +export interface TextToImageCreateParams { |
| 26 | + /** |
| 27 | + * The model variant to use. |
| 28 | + */ |
| 29 | + model: 'gen4_image'; |
| 30 | + |
| 31 | + /** |
| 32 | + * A non-empty string up to 1000 characters (measured in UTF-16 code units). This |
| 33 | + * should describe in detail what should appear in the output. |
| 34 | + */ |
| 35 | + promptText: string; |
| 36 | + |
| 37 | + /** |
| 38 | + * The resolution of the output image(s). |
| 39 | + */ |
| 40 | + ratio: |
| 41 | + | '1920:1080' |
| 42 | + | '1080:1920' |
| 43 | + | '1024:1024' |
| 44 | + | '1360:768' |
| 45 | + | '1080:1080' |
| 46 | + | '1168:880' |
| 47 | + | '1440:1080' |
| 48 | + | '1080:1440' |
| 49 | + | '1808:768' |
| 50 | + | '2112:912'; |
| 51 | + |
| 52 | + /** |
| 53 | + * Settings that affect the behavior of the content moderation system. |
| 54 | + */ |
| 55 | + contentModeration?: TextToImageCreateParams.ContentModeration; |
| 56 | + |
| 57 | + /** |
| 58 | + * An array of images to be used as references for the generated image output. Up |
| 59 | + * to three reference images can be provided. |
| 60 | + */ |
| 61 | + referenceImages?: Array<TextToImageCreateParams.ReferenceImage>; |
| 62 | + |
| 63 | + /** |
| 64 | + * If unspecified, a random number is chosen. Varying the seed integer is a way to |
| 65 | + * get different results for the same other request parameters. Using the same seed |
| 66 | + * integer for an identical request will produce similar results. |
| 67 | + */ |
| 68 | + seed?: number; |
| 69 | +} |
| 70 | + |
| 71 | +export namespace TextToImageCreateParams { |
| 72 | + /** |
| 73 | + * Settings that affect the behavior of the content moderation system. |
| 74 | + */ |
| 75 | + export interface ContentModeration { |
| 76 | + /** |
| 77 | + * When set to `low`, the content moderation system will be less strict about |
| 78 | + * preventing generations that include recognizable public figures. |
| 79 | + */ |
| 80 | + publicFigureThreshold?: 'auto' | 'low'; |
| 81 | + } |
| 82 | + |
| 83 | + export interface ReferenceImage { |
| 84 | + /** |
| 85 | + * A HTTPS URL or data URI containing an encoded image to be used as reference for |
| 86 | + * the generated output image. See [our docs](/assets/inputs#images) on image |
| 87 | + * inputs for more information. |
| 88 | + */ |
| 89 | + uri: string; |
| 90 | + |
| 91 | + /** |
| 92 | + * A name used to refer to the image reference, from 3 to 16 characters in length. |
| 93 | + * Tags must be alphanumeric (plus underscores) and start with a letter. You can |
| 94 | + * refer to the reference image's tag in the prompt text with at-mention syntax: |
| 95 | + * `@tag`. Tags are case-sensitive. |
| 96 | + */ |
| 97 | + tag?: string; |
| 98 | + } |
| 99 | +} |
| 100 | + |
| 101 | +export declare namespace TextToImage { |
| 102 | + export { |
| 103 | + type TextToImageCreateResponse as TextToImageCreateResponse, |
| 104 | + type TextToImageCreateParams as TextToImageCreateParams, |
| 105 | + }; |
| 106 | +} |
0 commit comments