Add Replicate Model to Catalog
Add a new Replicate model to the Renku pricing catalog.
Step 1: Gather Information
Ask the user for:
- Model name (e.g.,
openai/sora-2) — always inowner/model-nameformat - Model type:
video,image, oraudio
Step 2: Fetch JSON Schema
Run the schema fetcher to download the model's input schema:
node scripts/fetch-replicate-schema.mjs <owner/model-name> --type=<type>
This creates a JSON file in catalog/models/replicate/<type>/. If the schema already exists, skip this step.
Requires REPLICATE_API_TOKEN environment variable.
Step 3: Analyze Schema
Read the generated JSON schema file. It uses a flat format ({type, title, required, properties}) with x-order for field ordering. Identify cost-relevant input fields:
- Video models: Look for
duration,seconds,generate_audio,mode,resolution,aspect_ratio - Image models: Look for
image_size,quality,num_images,resolution,width,height - Audio/TTS models: Look for
text,duration
Step 4: Look Up Pricing
Browse the model's Replicate pricing section directly using the #pricing anchor:
- Get Chrome tab context with
tabs_context_mcp - Create a new tab with
tabs_create_mcp - Navigate to
https://replicate.com/<owner>/<model-name>#pricing - Use
findto search for "cost per second", "price", or pricing amounts - Take a screenshot to read the pricing cards
- Extract the pricing data (per-second, per-run, per-character, etc.) and criteria (mode, audio, resolution)
Step 5: 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 second + mode (standard/pro) | costByVideoDurationAndMode |
| Per second + mode + audio toggle | costByVideoDurationModeAndAudio |
| 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 6: Build & Insert YAML Entry
Read docs/replicate-yaml-format-reference.md for the full format reference and section map.
- Read
catalog/models/replicate/replicate.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 7: Verify
Run the dry-run verifier:
node scripts/update-replicate-catalog.mjs catalog/models/replicate/replicate.yaml --dry-run
If you modified cost-functions.ts, also run:
pnpm --filter @gorenku/providers check:all