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.
client.models.retrieve(modelID)
Section titled “client.models.retrieve(modelID)”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
| Name | Type | Description |
|---|---|---|
modelID | string | The model ID to retrieve. |
query? | ModelRetrieveParams | null | Optional query parameters. |
Returns
APIPromise<EnhancedModelRetrieveResponse> — the standard retrieve response with model enhanced:
| Property | Type | Description |
|---|---|---|
model | ModelRetrieveResponse.Model & ModelEntity | All 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 fieldconsole.log(model.name); // original fieldmodel.run(params)
Section titled “model.run(params)”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
| Name | Type | Description |
|---|---|---|
params.body | object | Model-specific inputs (prompt, images, etc.). |
params.dryRun? | unknown | If 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);