Appearance
AI Inspiration
Present-mode AI Inspiration APIs. Accessed via snaptrude.presentation.aiInspiration.
These APIs operate on Present canvas shape IDs and create outputs on the Present canvas. Pure backend generation without canvas output is out of scope. AI usage inherits the current user's AI quota.
Types
PluginAIInspirationShapeRef
| Property | Type | Description |
|---|---|---|
shapeId | string | Present canvas shape ID |
assetId | string | Optional tldraw asset ID |
kind | "image" | "view" | "video" | Shape kind |
outputType | "source" | "image" | "video" | Whether the shape is an original source or AI output |
sourceUrl | string | Optional resolved source URL when requested |
PluginAIInspirationRecipe
Versioned recipe object extracted from AI workflow lineage or saved into project metadata. Recipes contain slots, ordered steps, output kind, thumbnail, timestamps, and a duplicate-detection fingerprint.
Functions
listModels()
List supported AI Inspiration models.
- Returns:
Promise<{ defaultModelId: string; models: PluginAIInspirationModel[] }>
ts
const { defaultModelId, models } = await snaptrude.presentation.aiInspiration.listModels();getModelCapabilities(args)
Get capability flags for a model.
- Parameters:
args.modelId:string— Model ID fromlistModels
- Returns:
Promise<{ capability: PluginAIInspirationModelCapability }>
ts
const { capability } = await snaptrude.presentation.aiInspiration.getModelCapabilities({
modelId: "nano-banana-pro-2k"
});listSources(args)
List AI Inspiration-compatible shapes on the current Present page.
- Parameters:
args.includeGenerated:boolean— Include generated AI outputs. Defaults totrueargs.includeSourceUrl:boolean— Resolve source URLs. Defaults tofalse
- Returns:
Promise<{ sources: PluginAIInspirationShapeRef[] }> - Throws: If Present mode is not open
ts
const { sources } = await snaptrude.presentation.aiInspiration.listSources({
includeGenerated: true
});getSelection()
Get selected Present canvas shapes that can be used as AI Inspiration sources.
- Returns:
Promise<{ selectedShapeIds: string[]; sources: PluginAIInspirationShapeRef[] }> - Throws: If Present mode is not open
getPresetCatalog()
Get curated AI Inspiration preset categories and presets.
- Returns:
Promise<{ categories: PluginAIInspirationPresetCategory[]; presets: PluginAIInspirationPreset[] }>
generate(args)
Generate an image or video from a Present canvas source.
- Parameters:
args.sourceShapeId:string— Source image or view shape IDargs.prompt:string— User promptargs.modelId:string— Optional model IDargs.referenceShapeIds:string[]— Optional reference image/view shape IDsargs.appliedPreset:PluginAIInspirationAppliedPreset— Optional presetargs.site:PluginAIInspirationSiteOptions— Optional site contextargs.regionHint:{ x; y; w; h }— Optional image-region guidanceargs.sketchGuidance:PluginAIInspirationSketchGuidance— Optional shape/text guidanceargs.video:PluginAIInspirationVideoOptions— Optional video settingsargs.runMode:"blocking" \| "job"— Defaults to blocking
- Returns:
Promise<PluginAIInspirationRunResult> - Throws: For unsupported model/input combinations, missing sources, or AI/backend failures
ts
const { sources } = await snaptrude.presentation.aiInspiration.listSources({});
const result = await snaptrude.presentation.aiInspiration.generate({
sourceShapeId: sources[0].shapeId,
prompt: "Make this a warm dusk exterior render",
modelId: "nano-banana-pro-2k",
referenceShapeIds: sources.slice(1, 3).map((source) => source.shapeId)
});Use job mode for long-running video, recipe, or branch rerun workflows:
ts
const { jobId } = await snaptrude.presentation.aiInspiration.generate({
sourceShapeId: "shape:source",
prompt: "Animate a slow dolly into the entrance",
modelId: "veo3",
video: { mode: "animate", motion: "slow-dolly", duration: "6s" },
runMode: "job"
});
const { job } = await snaptrude.presentation.aiInspiration.getJob({ jobId: jobId! });refine(args)
Upscale/refine an AI Inspiration source image using the native Topaz CGI path.
- Parameters:
args.sourceShapeId:stringargs.upscaleFactor:1.5 | 2 | 4— Defaults to2args.runMode:"blocking" \| "job"— Defaults to blocking
- Returns:
Promise<PluginAIInspirationRunResult>
getJob(args), cancelJob(args), listJobs()
Inspect and cancel transient AI Inspiration jobs in the current host session.
Cancellation is best-effort for recipe and branch rerun jobs because the native recipe runner does not yet accept an abort signal. Generation and refine jobs use the native abortable paths.
getWorkflowForShape(args)
Get the sanitized AI workflow graph containing a Present shape.
- Parameters:
args.shapeId:string
- Returns:
Promise<{ workflow: PluginAIInspirationWorkflow | null; node: PluginAIInspirationWorkflowNode | null }>
getSelectedBranchRerunPlan(args)
Build a rerun plan for the workflow branch ending at a generated shape.
- Parameters:
args.shapeId:string
- Returns: Ready plan data or an unavailable reason
rerunSelectedBranch(args)
Rerun a workflow branch and supersede the old branch metadata.
- Parameters:
args.shapeId:stringargs.endFrameShapeId:string— Optional keyframe end frameargs.runMode:"blocking" \| "job"— Defaults to blocking
- Returns:
Promise<PluginAIInspirationRunResult>
extractRecipeFromShape(args)
Extract a reusable recipe draft from the workflow path ending at a generated shape.
- Parameters:
args.shapeId:string
- Returns:
{ status: "ready"; draft }or{ status: "unavailable"; reason }
listRecipes(), saveRecipe(args), deleteRecipe(args)
Manage project-level AI Inspiration recipes stored in Present document metadata.
ts
const extraction = await snaptrude.presentation.aiInspiration.extractRecipeFromShape({
shapeId: "shape:generated-output"
});
if (extraction.status === "ready") {
await snaptrude.presentation.aiInspiration.saveRecipe({
draft: extraction.draft,
name: "Warm exterior workflow"
});
}runRecipe(args)
Run a saved or inline recipe against Present canvas slot shapes.
- Parameters:
args.recipeId:string— Saved recipe ID, required whenrecipeis omittedargs.recipe:PluginAIInspirationRecipe— Inline recipe, required whenrecipeIdis omittedargs.slotShapeIds:Record<string, string>— Slot ID to Present shape ID, includingsource-imageargs.runMode:"blocking" \| "job"— Defaults to blocking
- Returns:
Promise<PluginAIInspirationRunResult>
ts
const { recipes } = await snaptrude.presentation.aiInspiration.listRecipes();
await snaptrude.presentation.aiInspiration.runRecipe({
recipeId: recipes[0].id,
slotShapeIds: {
"source-image": "shape:source"
},
runMode: "job"
});