Run Replicate Model

Action ID: replicate_run_model

Description

Run any model on Replicate.com with your API token. This node allows you to execute machine learning models for image generation, text processing, and other AI tasks.

Provider

Replicate

Connection

Name
Description
Required
Category

Replicate Connection

The Replicate connection to use for the model.

replicate

Input Parameters

Name
Type
Required
Default
Description

model

string

-

The Replicate model to run (format: 'username/model_name:version' or 'username/model_name'). Example: 'stability-ai/sdxl:39ed52f2a78e934b3ba6e2a89f5b1c712de7dfea535525255b1aa35c5565e08b'

input_params

object

-

The input parameters for the model. These vary depending on the model you're using. Check the model's documentation for details.

image_input

string

-

-

Optional image input for models that require an image. This will be added to the input parameters with the key 'image'.

webhook_url

string

-

-

Optional webhook URL to receive updates when the prediction is complete.

View JSON Schema
{
  "description": "Run Replicate Model node input.",
  "properties": {
    "model": {
      "title": "Model",
      "type": "string",
      "description": "The Replicate model to run (format: 'username/model_name:version' or 'username/model_name'). Example: 'stability-ai/sdxl:39ed52f2a78e934b3ba6e2a89f5b1c712de7dfea535525255b1aa35c5565e08b'"
    },
    "input_params": {
      "title": "Input Parameters",
      "type": "object",
      "description": "The input parameters for the model. These vary depending on the model you're using. Check the model's documentation for details."
    },
    "image_input": {
      "default": null,
      "title": "Image Input",
      "type": "string",
      "description": "Optional image input for models that require an image. This will be added to the input parameters with the key 'image'."
    },
    "webhook_url": {
      "default": null,
      "title": "Webhook URL",
      "type": "string",
      "description": "Optional webhook URL to receive updates when the prediction is complete."
    }
  },
  "required": [
    "model",
    "input_params"
  ],
  "title": "ReplicateRunModelInput",
  "type": "object"
}

Output Parameters

Name
Type
Description

result

any

The output from the Replicate model. This can be text, URLs to generated images, or other data depending on the model.

View JSON Schema
{
  "description": "Output from a Replicate model.",
  "properties": {
    "result": {
      "title": "Result",
      "description": "The output from the Replicate model. This can be text, URLs to generated images, or other data depending on the model."
    }
  },
  "required": [
    "result"
  ],
  "title": "ReplicateModelOutput",
  "type": "object"
}

How It Works

This node sends a request to Replicate's API to run a specified machine learning model with your input parameters. Replicate queues the request and executes the model on their infrastructure. The node can optionally wait for the result synchronously or send a webhook URL to receive the result asynchronously. Once the model completes execution, the output (which may be images, text, or other data) is returned.

Usage Examples

Example 1: Image Generation with SDXL

Input:

model: "stability-ai/sdxl:39ed52f2a78e934b3ba6e2a89f5b1c712de7dfea535525255b1aa35c5565e08b"
input_params: {
  "prompt": "A serene landscape with mountains at sunset",
  "negative_prompt": "blurry, low quality",
  "num_inference_steps": 30,
  "guidance_scale": 7.5
}

Output:

result: [
  "https://replicate.delivery/pbxt/output_123.png"
]

Example 2: Text Generation Model

Input:

model: "mistralai/mistral-7b:5fe0a3d7cb86c4654d0629c949e306c7ec3fc47e2d917cdc880f4180f4e4991c"
input_params: {
  "prompt": "Write a short story about a robot",
  "max_tokens": 500,
  "temperature": 0.7
}

Output:

result: "Once upon a time, a robot named ARIA discovered a love for painting. Despite being designed for factory work..."

Example 3: Image with Webhook Notification

Input:

model: "stability-ai/sdxl"
input_params: {
  "prompt": "A futuristic city skyline"
}
webhook_url: "https://my-app.com/webhook/replicate"

Output:

result: "https://replicate.delivery/pbxt/output_456.png"

(Webhook will also be called with results when ready)

Common Use Cases

  • Image Generation: Generate images using models like SDXL, Stable Diffusion, or other image generators

  • Text Processing: Use language models for text generation, summarization, or translation

  • Audio Processing: Run models for speech synthesis, voice cloning, or audio enhancement

  • Video Generation: Create videos or video frames using generative models

  • Model Experimentation: Test and compare different ML models without local infrastructure

  • Batch Processing: Run models asynchronously using webhooks for long-running tasks

Error Handling

Error Type
Cause
Solution

Invalid Model

Model identifier doesn't exist or is malformed

Verify model format (username/model_name:version) on Replicate.com

Missing Input Parameters

Required parameters for the model are not provided

Check the model's documentation for required input parameters

Invalid Image URL

Image URL is not publicly accessible

Ensure URLs are publicly accessible and use http:// or https://

Timeout

Model execution takes longer than expected

Increase timeout or use webhook for asynchronous execution

Rate Limit

Too many concurrent API requests

Implement request queuing or use webhooks to distribute load

Insufficient Quota

Account doesn't have enough quota for the operation

Check your Replicate account quota and billing status

Notes

  • Model Format: Always use the full model identifier. You can find available models and their versions on Replicate.com. For version-specific runs, include the version hash after a colon.

  • Input Parameters: The input_params object structure depends entirely on the model. Refer to the specific model's documentation on Replicate to understand what parameters it accepts.

  • Image URLs: URLs provided in image_input or within input_params should be publicly accessible. The model needs to download them.

  • Webhook Notifications: If you provide a webhook_url, Replicate will send a POST request to that URL when the model finishes running. This is useful for asynchronous workflows.

  • Output Format: Model outputs vary widely. Some return image URLs, others return text, and some return structured data. Check the specific model's documentation for output format.

  • Cost: Replicate charges based on model execution time. Check pricing for specific models to understand costs.

Last updated

Was this helpful?