Skip to content
Get started
TypeScript

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.


Generate with any model. Returns enhanced response with response.job.wait().

Signature

client.generate.runModel(
modelID: string,
params: GenerateRunModelParams,
options?: RequestOptions,
): APIPromise<WithJob<GenerateRunModelResponse>>
ParameterTypeDescription
modelIDstringThe model ID to run.
params.bodyobjectModel-specific inputs (prompt, images, etc.).
params.dryRun?unknownIf 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);

Caption images. Returns enhanced response with response.job.wait().

Signature

client.generate.caption(
params: GenerateCaptionParams,
options?: RequestOptions,
): APIPromise<WithJob<GenerateCaptionResponse>>
ParameterTypeDescription
params.imagesstring[]Image URLs or asset IDs to caption.
params.dryRun?unknownIf set, validates without executing.

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