Skip to content

Commit 6976bb2

Browse files
txt2img docs and types
1 parent 16dcf4c commit 6976bb2

1 file changed

Lines changed: 58 additions & 0 deletions

File tree

src/puter-js/types/modules/ai.d.ts

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,30 +116,88 @@ export interface Img2TxtOptions {
116116
}
117117

118118
export interface Txt2ImgOptions {
119+
/** Text description of the image to generate. */
119120
prompt?: string;
121+
/**
122+
* Image model to use (provider-specific). Defaults to `'gpt-image-1-mini'`
123+
* (OpenAI), or `'grok-2-image'` when `provider` is `'xai'`.
124+
*/
120125
model?: string;
126+
/**
127+
* Image quality / output size tier. Interpretation is provider- and
128+
* model-specific:
129+
* - OpenAI GPT models: `'high'` | `'medium'` | `'low'` (default `'low'`);
130+
* `gpt-image-2` also accepts `'auto'`.
131+
* - OpenAI DALL-E 3: `'hd'` | `'standard'` (default `'standard'`).
132+
* - Gemini: output size tier `'512'` | `'1K'` | `'2K'` | `'4K'`
133+
* (availability varies by model).
134+
*/
121135
quality?: string;
136+
/**
137+
* An input image for image-to-image generation. Replicate expects a URL;
138+
* Gemini expects a base64-encoded image.
139+
*/
122140
input_image?: string;
141+
/**
142+
* Multiple input images for image-to-image / multi-image generation.
143+
* Gemini expects base64-encoded images; Replicate expects image URLs.
144+
*/
145+
input_images?: string[];
146+
/**
147+
* MIME type of the input image(s), e.g. `'image/png'`. Used as a fallback
148+
* when the type cannot be auto-detected (Gemini).
149+
*/
123150
input_image_mime_type?: string;
124151
driver?: string;
125152
provider?: string;
126153
service?: string;
154+
/**
155+
* Aspect ratio as `{ w, h }` (e.g. `{ w: 16, h: 9 }`). Supported by OpenAI,
156+
* Gemini, and Replicate.
157+
*/
127158
ratio?: { w: number; h: number };
159+
/** Width of the image to generate, in pixels (Together). Default `1024`. */
128160
width?: number;
161+
/** Height of the image to generate, in pixels (Together). Default `1024`. */
129162
height?: number;
163+
/** Alternative way to specify the aspect ratio (Together). */
130164
aspect_ratio?: string;
165+
/**
166+
* Number of generation/inference steps (Together, default `20`; Replicate
167+
* `flux-schnell`).
168+
*/
131169
steps?: number;
170+
/** Seed used for generation; reuse to reproduce results (Together, Replicate). */
132171
seed?: number;
172+
/** Prompt describing what NOT to guide the image generation toward (Together). */
133173
negative_prompt?: string;
174+
/** Number of image results to generate (Together). Default `1`. */
134175
n?: number;
176+
/** URL of an input image for models that support it (Together). */
135177
image_url?: string;
178+
/** Base64-encoded input image for image-to-image generation (Together). */
136179
image_base64?: string;
180+
/** URL of a mask image for inpainting (Together). */
137181
mask_image_url?: string;
182+
/** Base64-encoded mask image for inpainting (Together). */
138183
mask_image_base64?: string;
184+
/** How strongly the prompt influences the output (Together). */
139185
prompt_strength?: number;
186+
/** When `true`, disables the safety checker (Together, Replicate). */
140187
disable_safety_checker?: boolean;
188+
/**
189+
* Format of the image response. Together: `'base64'` | `'url'`. Replicate:
190+
* output format, e.g. `'webp'` | `'jpg'` | `'png'`.
191+
*/
141192
response_format?: string;
193+
/** When `true`, returns a sample image without using credits. */
142194
test_mode?: boolean;
195+
/**
196+
* When set, the generated image is saved to this path on the Puter
197+
* filesystem. Relative paths resolve against the app's data directory
198+
* (`~/AppData/<appID>/`) when called from an app, or `~/` otherwise. The
199+
* caller must have write permission to the destination.
200+
*/
143201
puter_output_path?: string;
144202
}
145203

0 commit comments

Comments
 (0)