Skip to content
Get started
TypeScript

Models

API reference for enhanced model methods.

The models resource is enhanced so that retrieve() returns a response where response.model has a .run() method. All original methods (create, retrieve, update, list, delete) are inherited.


Get a model by ID. Returns an enhanced response where response.model has .run().

Signature

client.models.retrieve(
modelID: string,
query?: ModelRetrieveParams | null,
options?: RequestOptions,
): APIPromise<EnhancedModelRetrieveResponse>

Parameters

NameTypeDescription
modelIDstringThe model ID to retrieve.
query?ModelRetrieveParams | nullOptional query parameters.

Returns

APIPromise<EnhancedModelRetrieveResponse> — the standard retrieve response with model enhanced:

PropertyTypeDescription
modelModelRetrieveResponse.Model & ModelEntityAll original model fields plus .run().

Example

import Scenario from '@scenario-labs/sdk';
const client = new Scenario({ apiKey: '...' });
const { model } = await client.models.retrieve('model_...');
console.log(model.id); // original field
console.log(model.name); // original field

Available on response.model after calling client.models.retrieve(). Generates with this model. Shortcut for client.generate.runModel(model.id, params) — no need to repeat the model ID. Returns an enhanced response where response.job has .wait(). See Jobs for the full .wait() reference.

Signature

response.model.run(
params: GenerateRunModelParams,
options?: RequestOptions,
): APIPromise<WithJob<GenerateRunModelResponse>>

Parameters

NameTypeDescription
params.bodyobjectModel-specific inputs (prompt, images, etc.).
params.dryRun?unknownIf set, validates without executing.

Returns

APIPromise<WithJob<GenerateRunModelResponse>> — a generate response where response.job has .wait().

Example

import Scenario from '@scenario-labs/sdk';
const client = new Scenario({ apiKey: '...' });
const { model } = await client.models.retrieve('model_...');
const response = await model.run({
body: { prompt: 'a medieval shield with dragon emblem' },
});
const completed = await response.job.wait();
console.log(completed.status); // 'success'
console.log(completed.metadata?.assetIds);