smithery/aiskillstore

replicate-handler

Integrate with Replicate AI for running models (image generation, LLMs, etc.).

Installation

$ npx skills add smithery/aiskillstore --skill replicate-handler

Similar popular skills

Related neighbors and high-traction skills in the same topics — useful to compare before installing.

Also in this package

Other skills from smithery/aiskillstore · top by installs.

npx skills add smithery/aiskillstore

Browse all from smithery/aiskillstore

More details

Agent compatibility

Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.

Claude Code Not declared
Cursor Not declared
Codex Not declared
GitHub Copilot Not declared
Windsurf Not declared
Gemini CLI Not declared
Cline Not declared
OpenCode Not declared

Package contents

Files included with this skill beyond the listing page.

  • skill md SKILL.md 2,015 B
  • docs SUMMARY.md 103 B

History

  1. First recorded snapshot · 0 installs

SKILL.md

Replicate Handler

Setup

  1. Install: npm install replicate
  2. Environment: Add REPLICATEAPITOKEN to .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](reference.md) for the full type definitions of the Replicate SDK.