GET and Filter Models
One of the most common API tasks is retrieving the right model for your generation. The GET /models endpoint offers flexible filtering to help you distinguish between your private models, official Scenario models, and third-party community models.
Endpoint: GET https://api.cloud.scenario.com/v1/models
Filtering by Privacy
Section titled “Filtering by Privacy”Private Models: By default, calling GET /models with your credentials returns only your private models (models you have trained).
Public Models: To access public models, call GET /models with privacy=public. The tags filter below is only available when privacy=public.
Filtering by Tags (Scenario vs. Third-Party)
Section titled “Filtering by Tags (Scenario vs. Third-Party)”You can use the tags query parameter to find specific categories of models. This is essential for building UIs that separate “Official” models from “Community” ones.
| Tag | Description |
|---|---|
sc:scenario |
Official Scenario Models. High-quality base models and styles curated by the Scenario team. |
sc:third-party |
Third-Party Models. Public models created by partners or the community. |
To retrieve Public Models (including Scenario’s official models and community public models), add privacy=public to the query.
Endpoint: GET https://api.cloud.scenario.com/v1/models?privacy=public
To view and update your model’s Description, use the following endpoints:
GET https://api.cloud.scenario.com/v1/models/{modelId}/descriptionPUT https://api.cloud.scenario.com/v1/models/{modelId}/description
Integration Code Examples
Section titled “Integration Code Examples”Below are practical examples that authenticate and fetch models based on the tags discussed above.
import Scenario from '@scenario-labs/sdk';
const client = new Scenario({ apiKey: 'YOUR_API_KEY', apiSecret: 'YOUR_API_SECRET',});
async function getModels(tag?: string) { // Set parameters const params: { pageSize: number; privacy: 'public'; tags?: string } = { pageSize: 10, privacy: 'public', }; if (tag) params.tags = tag;
// Fetch data try { const response = await client.models.list(params); console.log(`--- Found ${response.models.length} models for tag: ${tag} ---`);
response.models.forEach((m) => console.log(`- ${m.name} (${m.id})`)); } catch (error) { console.error('Error:', error); }}
// UsagegetModels('sc:scenario'); // Fetch Official ModelsgetModels('sc:third-party'); // Fetch Community Modelsfrom scenario_sdk import Scenario
client = Scenario( api_key="YOUR_API_KEY", api_secret="YOUR_API_SECRET",)
def get_models(tag=None): # Set parameters params = {"page_size": 10, "privacy": "public"} if tag: params["tags"] = tag
# Fetch data try: response = client.models.list(**params) models = response.models
print(f"--- Found {len(models)} models for tag: {tag} ---") for m in models: print(f"- {m.name} (ID: {m.id})")
except Exception as e: print(f"Error: {e}")
# Usageget_models(tag="sc:scenario") # Fetch Official Modelsget_models(tag="sc:third-party") # Fetch Community Models# Official Scenario modelscurl -u "YOUR_API_KEY:YOUR_API_SECRET" \ "https://api.cloud.scenario.com/v1/models?privacy=public&tags=sc:scenario&pageSize=10"
# Third-party modelscurl -u "YOUR_API_KEY:YOUR_API_SECRET" \ "https://api.cloud.scenario.com/v1/models?privacy=public&tags=sc:third-party&pageSize=10"