Skip to content

Instantly share code, notes, and snippets.

@lucataco
Created March 14, 2026 19:07
Show Gist options
  • Select an option

  • Save lucataco/ff34030074a452bf8620429b253edf34 to your computer and use it in GitHub Desktop.

Select an option

Save lucataco/ff34030074a452bf8620429b253edf34 to your computer and use it in GitHub Desktop.
Openclaw Replicat skill
name replicate
description Search, explore, and run ML models on Replicate (image gen, video, audio, text, etc.)
homepage https://replicate.com
metadata
openclaw
requires primaryEnv
bins env
curl
jq
REPLICATE_API_TOKEN
REPLICATE_API_TOKEN

Replicate

Run state-of-the-art open-source and proprietary ML models via the Replicate cloud API.

API key

  • REPLICATE_API_TOKEN env var
  • Or set skills.entries.replicate.apiKey / skills.entries.replicate.env.REPLICATE_API_TOKEN in ~/.openclaw/openclaw.json

Key concepts

  • Models are identified as owner/name (e.g. black-forest-labs/flux-schnell).
  • Official models are always warm, predictably priced, and have stable APIs. Use the owner/name format.
  • Community models require a version ID: owner/name:version_id.
  • Predictions are individual runs of a model. States: starting -> processing -> succeeded/failed/canceled.

Operations

Search for models

curl -s -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
  "https://api.replicate.com/v1/search?query=QUERY" | jq .

The response includes .models[] with model.owner, model.name, model.description, model.run_count, and .metadata.tags. Also check .collections[] for related curated lists.

To enrich results with official status and creation date:

curl -s -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
  "https://api.replicate.com/v1/models/OWNER/NAME" | jq '{is_official, created_at}'

Get model schema (always do this before running a model)

curl -s -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
  "https://api.replicate.com/v1/models/OWNER/NAME" | jq '{
    description,
    latest_version: .latest_version.id,
    input_schema: .latest_version.openapi_schema.components.schemas.Input.properties,
    output_schema: .latest_version.openapi_schema.components.schemas.Output
  }'

Run a model

For official models (owner/name, no version):

curl -s -X POST -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
  -H "Content-Type: application/json" \
  -H "Prefer: wait=60" \
  "https://api.replicate.com/v1/models/OWNER/NAME/predictions" \
  -d '{"input": {INPUT_PARAMS}}' | jq .

For community models (owner/name:version_id):

curl -s -X POST -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
  -H "Content-Type: application/json" \
  -H "Prefer: wait=60" \
  "https://api.replicate.com/v1/predictions" \
  -d '{"version": "VERSION_ID", "input": {INPUT_PARAMS}}' | jq .

The Prefer: wait=60 header makes the API wait up to 60 seconds for the prediction to complete before returning. If the prediction is still running, the response will have status: "processing" and you need to poll.

Poll for results

If status is not succeeded or failed, poll every 2-3 seconds:

curl -s -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
  "https://api.replicate.com/v1/predictions/PREDICTION_ID" | jq '{status, output, error, logs, metrics}'

Keep polling until status is succeeded, failed, or canceled. Print the .logs field on each poll to show progress.

Cancel a prediction

curl -s -X POST -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
  "https://api.replicate.com/v1/predictions/PREDICTION_ID/cancel"

Check account

curl -s -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
  "https://api.replicate.com/v1/account" | jq '{username, name, type}'

Workflow

When a user asks you to run a model or perform a task:

  1. If they haven't specified a model, search for appropriate ones
  2. Get the schema to understand the model's inputs before running it
  3. Run the model with the correct inputs -- use Prefer: wait=60 for sync, then poll if needed
  4. Present the output clearly -- for image URLs, display them; for JSON output, format it nicely
  5. Link to the prediction: https://replicate.com/p/PREDICTION_ID

Understanding user requests

Users often ask to generate things without specifying how. Plan which models to use.

Examples

  • "Make a commercial": Generate keyframes with an image model (FLUX, Nano Banana Pro), then generate video segments between keyframes in parallel with a video model, then stitch them together.
  • "Decorate my room": Ask for a room photo and style preferences, then use an image editing model with the inputs.
  • "Celebrity selfie video": Get a user selfie, find celebrity images (via web search if needed), generate keyframes, create video segments, stitch together.
  • "Summarize a PDF": Use an OCR model on Replicate to extract text, then summarize it yourself (no need for a language model on Replicate).
  • "Translate a video": Extract audio -> speech recognition -> translate text yourself -> text-to-speech -> lip sync model with original video.

Finding the right model

  • Always use the latest version of a model (Kling 3.0 over Kling 2.5, Nano Banana Pro over Nano Banana, etc.)
  • Prefer recently released models over old ones
  • Prefer official models over community models
  • High run counts can indicate old popular models, not necessarily the best current option
  • The search API does its best to surface recent state-of-the-art models, but apply judgment

Downloading outputs

When a prediction returns file URLs (images, audio, video), download them locally:

curl -sL "OUTPUT_URL" -o output_filename.png

Report the saved path so the user can access the file. Use descriptive filenames with timestamps when generating multiple outputs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment