← Back to Plugins
Tools

Replicat

lucataco By lucataco ⭐ 2 stars 👁 33 views ▲ 0 votes

An OpenClaw plugin that provides first-class tools for searching, exploring, and running ML models on Replicate

GitHub

Install

openclaw plugins install -l

README

# Replicate Plugin for OpenClaw

An OpenClaw plugin that provides first-class tools for searching, exploring, and running ML models on [Replicate](https://replicate.com).

## What it does

Registers four agent tools that the LLM can call directly:

| Tool | Description |
|---|---|
| `replicate_search` | Search for models by task or name. Enriches results with official status and creation date. |
| `replicate_schema` | Get a model's input/output OpenAPI schema. Always call this before running a model. |
| `replicate_run` | Run a prediction. Handles sync wait (60s) and automatic polling until completion. |
| `replicate_whoami` | Check the authenticated Replicate account. |

The plugin also ships a companion skill (`skills/replicate/SKILL.md`) that injects workflow guidance into the agent's prompt — how to plan multi-step creative tasks, which models to prefer, and how to present outputs.

## Setup

### 1. Install the plugin

**Link for development** (recommended while iterating):

```bash
openclaw plugins install -l /path/to/this/plugin
```

**Or copy into extensions:**

```bash
cp -r /path/to/this/plugin ~/.openclaw/extensions/replicate
```

**Or install from a local path:**

```bash
openclaw plugins install /path/to/this/plugin
```

### 2. Configure

Add to `~/.openclaw/openclaw.json`:

```json5
{
  plugins: {
    entries: {
      replicate: {
        enabled: true,
        config: {
          apiToken: "r8_your_token_here",
        },
      },
    },
  },
}
```

Or skip the config and just set the env var:

```bash
export REPLICATE_API_TOKEN=r8_...
```

The plugin checks `plugins.entries.replicate.config.apiToken` first, then falls back to `REPLICATE_API_TOKEN` env var.

### 3. Restart the gateway

```bash
openclaw gateway restart
```

### 4. Verify

Check that the plugin loaded:

```bash
openclaw plugins list
```

You should see `replicate` in the list. Then ask the agent:

> "What's my Replicate username?"

It should call `replicate_whoami` and return your account info.

## Usage

Just ask the agent to do things with ML models:

- "Generate an image of a cat in a spacesuit"
- "Search for video generation models on Replicate"
- "Run black-forest-labs/flux-schnell with prompt 'a sunset over mountains'"
- "Make a short commercial for my coffee shop"
- "Translate this video to Spanish"

The companion skill teaches the agent the full workflow: search -> get schema -> run model -> present output.

## Files

```
plugin/
├── openclaw.plugin.json    # Plugin manifest
├── package.json            # Dependencies (@sinclair/typebox)
├── index.ts                # Tool registration (4 tools)
└── skills/
    └── replicate/
        └── SKILL.md        # Workflow guidance for the agent
```

## How it works

The plugin is a TypeScript module loaded by OpenClaw's plugin system via [jiti](https://github.com/unjs/jiti). It exports a `register(api)` function that calls `api.registerTool()` four times — once per Replicate operation.

Each tool makes direct HTTP `fetch` calls to `https://api.replicate.com/v1`. The `replicate_run` tool uses the `Prefer: wait=60` header for sync mode, then falls back to polling every 2 seconds if the prediction is still running.

Tool input schemas are defined using [TypeBox](https://github.com/sinclairzx81/typebox), which produces JSON Schema compatible with OpenClaw's tool system.
tools

Comments

Sign in to leave a comment

Loading comments...