replicate-handler
Integrate with Replicate AI for running models (image generation, LLMs, etc.).
Best use case
replicate-handler is best used when you need a repeatable AI agent workflow instead of a one-off prompt. It is especially useful for teams working in multi. Integrate with Replicate AI for running models (image generation, LLMs, etc.).
Integrate with Replicate AI for running models (image generation, LLMs, etc.).
Users should expect a more consistent workflow output, faster repeated execution, and less time spent rewriting prompts from scratch.
Practical example
Example input
Use the "replicate-handler" skill to help with this workflow task. Context: Integrate with Replicate AI for running models (image generation, LLMs, etc.).
Example output
A structured workflow result with clearer steps, more consistent formatting, and an output that is easier to reuse in the next run.
When to use this skill
- Use this skill when you want a reusable workflow rather than writing the same prompt again and again.
When not to use this skill
- Do not use this when you only need a one-off answer and do not need a reusable workflow.
- Do not use it if you cannot install or maintain the related files, repository context, or supporting tools.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/replicate-handler/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How replicate-handler Compares
| Feature / Agent | replicate-handler | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Integrate with Replicate AI for running models (image generation, LLMs, etc.).
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# Replicate Handler
## Setup
1. **Install**: `npm install replicate`
2. **Environment**: Add `REPLICATE_API_TOKEN` to `.env` (and `.env.local`).
## Usage Patterns
### 1. Quick Run (Short Tasks)
For models that complete quickly (seconds), use `replicate.run`.
```typescript
import Replicate from "replicate";
const replicate = new Replicate({
auth: process.env.REPLICATE_API_TOKEN,
});
// Run a model
const output = await replicate.run(
"owner/model:version",
{
input: {
prompt: "..."
}
}
);
```
### 2. Long-Running Tasks (with Inngest)
For tasks that might timeout (video generation, large models), use Inngest's `step.sleep` to poll for completion.
```typescript
// In an Inngest function
export const generateVideo = inngest.createFunction(
{ id: "generate-video" },
{ event: "video.generate" },
async ({ event, step }) => {
// 1. Create Prediction
const prediction = await step.run("create-prediction", async () => {
return await replicate.predictions.create({
version: "model-version-hash",
input: { prompt: event.data.prompt }
});
});
let status = prediction.status;
let result = prediction;
// 2. Poll for Completion
while (status !== "succeeded" && status !== "failed" && status !== "canceled") {
// Sleep for 5s (Inngest handles this without consuming server time)
await step.sleep("wait-for-model", "5s");
// Check status
result = await step.run("check-status", async () => {
return await replicate.predictions.get(prediction.id);
});
status = result.status;
}
// 3. Handle Result
if (status === "failed") {
throw new Error(`Replicate failed: ${result.error}`);
}
return result.output;
}
);
```
## Types Reference
See [reference.md](reference.md) for the full type definitions of the Replicate SDK.Related Skills
error-handler-advisor
Proactively reviews error handling patterns and suggests improvements using Result types, proper error propagation, and idiomatic patterns. Activates when users write error handling code or use unwrap/expect.
ui-handler
Implement UI using Shadcn MCP (atoms/theme) and 21st.dev MCP (complex sections). Use when adding buttons, layouts, or generating landing pages.
theme-handler
Manage and update application themes using shadcn and tweakcn.
stripe-handler
Handle Stripe payments, custom checkouts, and webhook fulfillment outside of standard plans/credits.
seo-handler
Manage SEO, sitemaps, and metadata for optimal search engine visibility
s3-upload-handler
Handle S3 file uploads including UI components, client-side logic, and server-side processing
plate-handler
Implement rich text editors using Plate.js. Supports creating both simple (comment/chat) and detailed (document/blog) editors.
plans-handler
Manage subscription plans, pricing, and quotas. Use when adding plan features, updating limits, or building pricing pages.
inngest-handler
Create and manage Inngest functions for reliable background jobs, workflows, and scheduled tasks.
env-handler
Manage environment variables securely. Handles distinction between .env (template) and .env.local (secrets).
email-handler
Create and send transactional emails using React Email. Covers templates, layout integration, and sending logic.
db-handler
Manage database schemas, Drizzle ORM, migrations, and data modeling. Use when creating tables, modifying columns, or planning database changes.