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.
Integrate with Replicate AI for running models (image generation, LLMs, etc.).
Teams using replicate-handler should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
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
websocket-handler-setup
Websocket Handler Setup - Auto-activating skill for Backend Development. Triggers on: websocket handler setup, websocket handler setup Part of the Backend Development skill category.
webhook-retry-handler
Webhook Retry Handler - Auto-activating skill for API Integration. Triggers on: webhook retry handler, webhook retry handler Part of the API Integration skill category.
timeout-handler
Timeout Handler - Auto-activating skill for API Integration. Triggers on: timeout handler, timeout handler Part of the API Integration skill category.
sorting-parameter-handler
Sorting Parameter Handler - Auto-activating skill for API Development. Triggers on: sorting parameter handler, sorting parameter handler Part of the API Development skill category.
oauth-callback-handler
Oauth Callback Handler - Auto-activating skill for API Integration. Triggers on: oauth callback handler, oauth callback handler Part of the API Integration skill category.
long-polling-handler
Long Polling Handler - Auto-activating skill for API Integration. Triggers on: long polling handler, long polling handler Part of the API Integration skill category.
kubernetes-configmap-handler
Kubernetes Configmap Handler - Auto-activating skill for DevOps Advanced. Triggers on: kubernetes configmap handler, kubernetes configmap handler Part of the DevOps Advanced skill category.
go-handler-generator
Go Handler Generator - Auto-activating skill for Backend Development. Triggers on: go handler generator, go handler generator Part of the Backend Development skill category.
etag-handler
Etag Handler - Auto-activating skill for API Development. Triggers on: etag handler, etag handler Part of the API Development skill category.
error-handler-middleware
Error Handler Middleware - Auto-activating skill for Backend Development. Triggers on: error handler middleware, error handler middleware Part of the Backend Development skill category.
environment-variables-handler
Environment Variables Handler - Auto-activating skill for DevOps Basics. Triggers on: environment variables handler, environment variables handler Part of the DevOps Basics skill category.
creating-webhook-handlers
Create webhook endpoints with signature verification, retry logic, and payload validation. Use when receiving and processing webhook events. Trigger with phrases like "create webhook", "handle webhook events", or "setup webhook handler".