Generate
API reference for enhanced generate methods.
All generate methods return a response where response.job has .wait(). See Jobs for the full .wait() reference.
client.generate.runModel(modelID, params)
Section titled “client.generate.runModel(modelID, params)”Generate with any model. Returns enhanced response with response.job.wait().
Signature
client.generate.runModel( modelID: string, params: GenerateRunModelParams, options?: RequestOptions,): APIPromise<WithJob<GenerateRunModelResponse>>| Parameter | Type | Description |
|---|---|---|
modelID | string | The model ID to run. |
params.body | object | Model-specific inputs (prompt, images, etc.). |
params.dryRun? | unknown | If set, validates without executing. |
Example
const response = await client.generate.runModel('model_...', { body: { prompt: 'a medieval shield with dragon emblem' },});
const completed = await response.job.wait();console.log(completed.status);console.log(completed.metadata?.assetIds);client.generate.caption(params)
Section titled “client.generate.caption(params)”Caption images. Returns enhanced response with response.job.wait().
Signature
client.generate.caption( params: GenerateCaptionParams, options?: RequestOptions,): APIPromise<WithJob<GenerateCaptionResponse>>| Parameter | Type | Description |
|---|---|---|
params.images | string[] | Image URLs or asset IDs to caption. |
params.dryRun? | unknown | If set, validates without executing. |
client.generate.describeStyle(params)
Section titled “client.generate.describeStyle(params)”Describe the style of images or models. Returns enhanced response with response.job.wait().
Signature
client.generate.describeStyle( params: GenerateDescribeStyleParams, options?: RequestOptions,): APIPromise<WithJob<GenerateDescribeStyleResponse>>client.generate.detect(params)
Section titled “client.generate.detect(params)”Transform visual data from input images into mode maps. Returns enhanced response with response.job.wait().
Signature
client.generate.detect( params: GenerateDetectParams, options?: RequestOptions,): APIPromise<WithJob<GenerateDetectResponse>>client.generate.embed(params)
Section titled “client.generate.embed(params)”Get embeddings from text. Returns enhanced response with response.job.wait().
Signature
client.generate.embed( params: GenerateEmbedParams, options?: RequestOptions,): APIPromise<WithJob<GenerateEmbedResponse>>client.generate.patch(params)
Section titled “client.generate.patch(params)”Patch an asset with an image. Returns enhanced response with response.job.wait().
Signature
client.generate.patch( params: GeneratePatchParams, options?: RequestOptions,): APIPromise<WithJob<GeneratePatchResponse>>client.generate.translate(params)
Section titled “client.generate.translate(params)”Translate text to English. Returns enhanced response with response.job.wait().
Signature
client.generate.translate( params: GenerateTranslateParams, options?: RequestOptions,): APIPromise<WithJob<GenerateTranslateResponse>>Common pattern
Section titled “Common pattern”Every generate method follows the same pattern:
// 1. Call the methodconst response = await client.generate.<method>(params);
// 2. Wait for completionconst completed = await response.job.wait();
// 3. Access resultsconsole.log(completed.status);console.log(completed.metadata?.assetIds);