Agent skill · software engineering · aiskillstore

ai-handler

Integrate Replicate AI models with background processing, S3 storage, and credit systems

Why this skill is useful

Adds a complete integration pattern with executable code for managing Replicate AI models, including background processing and S3 uploads.

What it needs

Requires replicate installed locally. Requires inngest, s3 account access. About 2k tokens when loaded. Last updated 2026-08-07. 405 stars on the source repository.

What this skill does

Replicate AI Handler Skill This skill provides a production-ready pattern for integrating Replicate AI models. It handles long-running predictions using Inngest background jobs, stores results in S3, manages user credits, and updates database state. Architecture 1. Trigger: User requests a generation via API (e.g., /api/app/ai-images). 2. Validation: Check/deduct user credits. 3. State: Create a database record with status: "processing". 4. Queue: Trigger an Inngest function to handle the Replicate API call. 5. Processing: Call Replicate API. Wait for completion (polling or webhook). Download result and upload to S3 (server-side). 6. Completion: Update database record with S3 URL and status: "completed". 7. Failure: Refund credits if failed (optional) and update status to failed. Prerequisites replicate package installed (npm install replicate). REPLICATEAPITOKEN in .env. S3 and Inngest configured. Implementation Steps 1. API Route (Trigger) src/app/api/app/generate/route.ts 2. Inngest Function (Processor) src/lib/inngest/functions/app/ai/generate.ts

How to use it

Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:

@skills aiskillstore/ai-handler

View the source on GitHub

Browse the @skills marketplace