Agent skill
replicate-handler
Integrate with Replicate AI for running models (image generation, LLMs, etc.).
Install this agent skill to your Project
npx add-skill https://github.com/aiskillstore/marketplace/tree/main/skills/aayushbaniya2006/replicate-handler
SKILL.md
Replicate Handler
Setup
- Install:
npm install replicate - Environment: Add
REPLICATE_API_TOKENto.env(and.env.local).
Usage Patterns
1. Quick Run (Short Tasks)
For models that complete quickly (seconds), use replicate.run.
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.
// 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 for the full type definitions of the Replicate SDK.
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
perigon-backend
Perigon ASP.NET Core + EF Core + Aspire conventions
perigon-agent
Pointers for Copilot/agents to apply Perigon conventions
perigon-angular
Angular 21+ standalone/Material/signal conventions for Perigon WebApp
fastapi-mastery
Comprehensive FastAPI development skill covering REST API creation, routing, request/response handling, validation, authentication, database integration, middleware, and deployment. Use when working with FastAPI projects, building APIs, implementing CRUD operations, setting up authentication/authorization, integrating databases (SQL/NoSQL), adding middleware, handling WebSockets, or deploying FastAPI applications. Triggered by requests involving .py files with FastAPI code, API endpoint creation, Pydantic models, or FastAPI-specific features.
context7-efficient
Token-efficient library documentation fetcher using Context7 MCP with 86.8% token savings through intelligent shell pipeline filtering. Fetches code examples, API references, and best practices for JavaScript, Python, Go, Rust, and other libraries. Use when users ask about library documentation, need code examples, want API usage patterns, are learning a new framework, need syntax reference, or troubleshooting with library-specific information. Triggers include questions like "Show me React hooks", "How do I use Prisma", "What's the Next.js routing syntax", or any request for library/framework documentation.
browser-use
Browser automation using Playwright MCP. Navigate websites, fill forms, click elements, take screenshots, and extract data. Use when tasks require web browsing, form submission, web scraping, UI testing, or any browser interaction.
Didn't find tool you were looking for?