Agent skill
add-fal-model
Add new fal.ai models to the Renku catalog. Fetches JSON schema, looks up pricing from fal.ai, matches/implements cost function, adds entry to fal-ai.yaml.
Install this agent skill to your Project
npx add-skill https://github.com/keremk/renku/tree/main/.claude/skills/add-fal-model
SKILL.md
Add fal.ai Model to Catalog
Add a new fal.ai model to the Renku pricing catalog.
Step 1: Gather Information
Ask the user for:
- Model name (e.g.,
kling-video/v3/pro/text-to-video) - Model type:
video,image,audio,stt, orjson - Sub-provider (optional): e.g.,
wan,xai— only if the model is not native to fal.ai
Step 2: Fetch JSON Schema
Run the schema fetcher to download the model's input/output schema:
node scripts/fetch-fal-schema.mjs <model-name> --type=<type> [--subprovider=<sub>]
This creates a JSON file in catalog/models/fal-ai/<type>/. If the schema already exists, skip this step.
Step 3: Annotate Viewer Metadata (Required)
Immediately annotate and validate viewer metadata after schema fetch:
node scripts/annotate-viewer-schemas.mjs --model=<model-name>
node scripts/validate-viewer-schemas.mjs --model=<model-name>
Notes:
x-renku-vieweris the UI source of truth for component initialization.- If validation reports
placeholder-to-be-annotatedpointers, ask the user exactly which component should be used for each pointer and update annotations before continuing. - Do not leave unresolved placeholders for newly added models unless user explicitly agrees.
Step 3a: Voice-ID Markers for Audio/TTS (Required when applicable)
For audio narration/TTS schemas, propose voice field markers before moving on:
- Heuristic candidates to inspect (proposal only):
voice,voice_id,voiceId, and nested variants likevoice_setting.voice_id - Ask the user to confirm exactly which schema pointer(s) should be marked
- After confirmation, annotate the source schema node (or referenced definition node) with:
"x-voice-id": true- optionally
"x-voices-file": "voices/<file>.json"when shared rich voice metadata exists
Important rules:
- Never place
x-voice-id/x-voices-fileunderx-renku-viewer; they belong to the original schema node. - When
x-voices-fileis present, it is authoritative for voice options. - Re-run annotation + validation after applying these markers:
node scripts/annotate-viewer-schemas.mjs --model=<model-name>
node scripts/validate-viewer-schemas.mjs --model=<model-name>
Step 4: Analyze Schema
Read the generated JSON schema file and its x-renku-viewer annotations. Identify cost-relevant input fields:
- Video models: Look for
duration,generate_audio,num_frames,video_size,resolution,aspect_ratio - Image models: Look for
image_size,quality,num_images,resolution,width,height - Audio/TTS models: Look for
text,duration - STT models: Look for
duration
Step 5: Look Up Pricing
Browse the model's fal.ai page to find pricing:
- Get Chrome tab context with
tabs_context_mcp - Create a new tab with
tabs_create_mcp - Navigate to the correct URL based on whether the model has a sub-provider:
- Native fal.ai model (no sub-provider):
https://fal.ai/models/fal-ai/<model-name> - Sub-provider model (e.g.,
subProvider: xai,subProvider: wan):https://fal.ai/models/<model-name>(nofal-ai/prefix)
- Native fal.ai model (no sub-provider):
- Use
findto search for "cost per second", "price", or "charged" - Extract the pricing data (per-second, per-megapixel, per-run, etc.)
Step 6: Select or Implement Cost Function
Read docs/cost-functions-reference.md in this skill directory for the full reference.
Match the model's pricing to an existing cost function:
| Pricing Pattern | Cost Function |
|---|---|
| Flat per run | costByRun |
| Per second (simple) | costByVideoDuration |
| Per second + audio toggle | costByVideoDurationAndWithAudio |
| Per second + resolution tiers | costByVideoDurationAndResolution |
| Per megapixel (video) | costByVideoMegapixels |
| Per million tokens | costByVideoPerMillionTokens |
| Per character | costByCharacters |
| Per second (audio) | costByAudioSeconds |
| Per megapixel (image) | costByImageMegapixels |
| Size + quality grid | costByImageSizeAndQuality |
| Resolution tiers (image) | costByImageAndResolution |
| Dimension-based (image) | costByResolution |
| Per token (text) | costByInputTokens |
If no existing function matches, implement a new one following the guide in docs/cost-functions-reference.md under "How to Add a New Cost Function".
Step 7: Build & Insert YAML Entry
Read docs/fal-yaml-format-reference.md for the full format reference and section map.
- Read
catalog/models/fal-ai/fal-ai.yaml - Find the correct insertion point based on model family (see Section Map in the reference)
- Build the YAML entry using the appropriate template
- Insert using the Edit tool
Step 8: Verify
Run the dry-run verifier:
node scripts/update-fal-catalog.mjs catalog/models/fal-ai/fal-ai.yaml --dry-run
node scripts/validate-viewer-schemas.mjs --model=<model-name>
If you modified cost-functions.ts, also run:
pnpm --filter @gorenku/providers check:all
Step 9: Add to Producer Files
Map each new model to the correct producer YAML under catalog/producers/.
9a: Determine Producer Mapping
Read the relevant producer files and the model schemas, then build a proposed mapping table. Present it to the user in this format before making any changes:
| Model | Producer file | Reasoning |
|---|---|---|
| `model-name` | `category/producer.yaml` | why this producer fits |
Also show the proposed field-level mappings for each model:
- Which producer inputs map to which API fields
- Any transformations needed (intToString, resolution mode, asArray, etc.)
Use AskUserQuestion to present this table and ask:
"Does this mapping look correct? Let me know if anything needs adjusting before I add it."
Wait for confirmation before proceeding to 9b.
9b: Producer Selection Reference
| Model type / schema inputs | Producer file |
|---|---|
text (TTS) |
audio/text-to-speech.yaml |
reference_image_urls array + prompt + duration |
video/ref-image-to-video.yaml |
video_url + prompt + duration (extend) |
video/extend-video.yaml |
image_url + prompt + duration (single image) |
video/image-to-video.yaml |
prompt + duration only (text-to-video) |
video/text-to-video.yaml |
prompt + duration + video editing |
video/video-edit.yaml |
9c: Insert Mappings
For each model, add an entry under mappings.fal-ai: in the correct producer YAML, following existing patterns in that file. Use the Edit tool to insert after the last existing fal-ai: entry.
Common transformation patterns:
- Plain integer duration:
Duration: duration - Duration as string:
Duration: { field: duration, intToString: true } - Duration as seconds string:
Duration: { field: duration, intToSecondsString: true } - Aspect ratio only:
Resolution: { field: aspect_ratio, resolution: { mode: aspectRatio } } - Aspect ratio + preset:
Resolution: { expand: true, resolution: { mode: aspectRatioAndPresetObject, aspectRatioField: aspect_ratio, presetField: resolution } } - Sub-provider models: use the model name as-is (e.g.,
xai/grok-imagine-video/extend-video:)
9d: Validate Producer Mapping Contracts (Required)
After adding or updating producer mappings, run the producer mapping contract suite from the repo root:
pnpm validate:producers
Do not finish until this command passes. If it fails, fix the producer mappings and re-run.
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
integration-astro-static
PostHog integration for static Astro sites using SSG
add-replicate-model
Add new Replicate models to the Renku catalog. Fetches JSON schema, looks up pricing from replicate.com, matches/implements cost function, adds entry to replicate.yaml.
prepare-r2-video
Convert a local video into a web-friendly video asset for Cloudflare R2. Inspects the source with ffprobe, encodes with ffmpeg while preserving aspect ratio, and asks for explicit confirmation before running npx wrangler upload.
skill-creator
Guide for creating effective skills. This skill should be used when users want to create a new skill (or update an existing skill) that extends Claude's capabilities with specialized knowledge, workflows, or tool integrations.
create-prompt-producer
Create the definition files for the Renku Prompt Producer, which leverages an LLM to generate high-quality, structured prompts or audio narration texts consumed by downstream media generation models within the Renku video-creation blueprint.
edit-article
Edit and improve articles by restructuring sections, improving clarity, and tightening prose. Use when user wants to edit, revise, or improve an article draft.
Didn't find tool you were looking for?