Skip to content
Get started
TypeScript

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.


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);

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.

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>>

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>>

Get embeddings from text. Returns enhanced response with response.job.wait().

Signature

client.generate.embed(
params: GenerateEmbedParams,
options?: RequestOptions,
): APIPromise<WithJob<GenerateEmbedResponse>>

Patch an asset with an image. Returns enhanced response with response.job.wait().

Signature

client.generate.patch(
params: GeneratePatchParams,
options?: RequestOptions,
): APIPromise<WithJob<GeneratePatchResponse>>

Translate text to English. Returns enhanced response with response.job.wait().

Signature

client.generate.translate(
params: GenerateTranslateParams,
options?: RequestOptions,
): APIPromise<WithJob<GenerateTranslateResponse>>

Every enhanced generate method (all except prompt(), ipDetection() and qualityGate()) follows the same pattern:

// 1. Call the method
const response = await client.generate.<method>(params);
// 2. Wait for completion
const completed = await response.job.wait();
// 3. Access results
console.log(completed.status);
console.log(completed.metadata?.assetIds);