Generate
API reference for enhanced generate methods.
caption, describeStyle, detect, embed, patch, runModel and translate return a response where response.job has .wait(). prompt() is inherited unchanged: its job has no .wait(). ipDetection() and qualityGate() are inherited unchanged too: they return their result directly, with no job. 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 |
unknown |
Model-specific inputs (prompt, images, etc.). The accepted inputs come from GET /models/{modelId}. |
params.dryRun? |
'true' | 'api' |
Estimates the creative units cost (269 response) instead of running. 'api' estimates at the API tier. The response then carries only the cost estimate (creativeUnitsCost) and no job, so don’t call .wait() on it. |
params.ipDetection? |
boolean |
Runs an IP-detection preflight (Enterprise plan only). The detection fee is charged even with dryRun. |
params.projectId? |
string |
Project that owns the resource. |
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[] |
Data URLs or asset IDs of the images to caption. |
params.dryRun? |
'true' | 'api' |
Estimates the creative units cost (269 response) instead of running. 'api' estimates at the API tier. The response then carries only the cost estimate (creativeUnitsCost) and no job, so don’t call .wait() on it. |
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 enhanced generate method (all except prompt(), ipDetection() and qualityGate()) 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);