multiAI Summary Pending
replicate-handler
Integrate with Replicate AI for running models (image generation, LLMs, etc.).
231 stars
Installation
Claude Code / Cursor / Codex
$curl -o ~/.claude/skills/replicate-handler/SKILL.md --create-dirs "https://raw.githubusercontent.com/aiskillstore/marketplace/main/skills/aayushbaniya2006/replicate-handler/SKILL.md"
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 | multi | 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.).
Which AI agents support this skill?
This skill is compatible with multi.
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.