app icon
upstash-ratelimit
0.0.1

This plugin provides Upstash's Redis-based rate limiting service integrated with Dify AI platform.

elifnurdeniz/upstash-ratelimit238 installs

upstash-ratelimit

Author: elifnurdeniz
Version: 0.0.1
Type: tool

Description

Upstash Rate Limit Plugin for Dify

🚀 Overview

The Upstash Rate Limit Plugin integrates Upstash's Redis-based rate limiting service with the Dify AI platform. This plugin allows developers to enforce request limits within a defined time window using fixed or sliding window strategies.

✨ Benefits

  • Prevents API Exhaustion – Ensures services are not overwhelmed by excessive requests, protecting system resources.
  • Protects Against Abuse & Misuse – Limits excessive requests from malicious actors or misconfigured applications.
  • Optimizes Costs – Prevents unnecessary API usage, reducing server costs for cloud-based applications.
  • Built for Scalability – Upstash Redis is a serverless database, ensuring the rate limiter scales with flexibility both up and down.

🛠️ Features

  • Redis-Based Rate Limiting: Leverages Upstash Redis for efficient rate limiting.
  • Fixed and Sliding Window Support: Choose between different rate-limiting strategies.
  • Per User or Global Rate Limiting: Apply rate limits per user or globally.
  • Customizable Parameters: Configure window size, max requests, and rate limit scope.

🔧 Setup & Configuration

1️⃣ Prerequisites

  • A Dify AI instance running
  • An Upstash Redis account (Sign up here)
  • A Redis Database (Create from here)
  • Your Upstash Redis REST URL and REST Token

2️⃣ Installation

To install and activate the plugin:

  1. Navigate to the Dify Plugin Store.
  2. Search for Upstash-Ratelimit.
  3. Click Install and follow the setup instructions.

3️⃣ Plugin Configuration

After installation, you must provide:

  • Upstash Redis REST URL: The REST API endpoint for your Upstash Redis database.
  • Upstash Redis REST Token: The API authentication token for your Redis instance.

4️⃣ Usage

This plugin can be used within a Dify Chatflow / Workflow / Agent to control request limits.
The plugin outputs structured JSON data, including key fields that can be used to handle the request.
The success or failure of a request can be verified using the variable.
You can add an condition in the app:

  • If the status contains "success", continue the request.
  • If status contains "error", take alternative actions (e.g., return a rate limit exceeded message).

📌 Available Parameters

ParameterTypeRequiredDescription
Select✅ YesDefines the rate limit type ( or ). Learn more here.
Number✅ YesTime window size in seconds.
Number✅ YesMaximum allowed requests within the window.
Select✅ YesApplies rate limit rule for all users or per user.
Number❌ NoNumber of requests deducted per operation. Defaults to .

Example Usage

A sliding window rate limit that allows 10 requests per minute globally:

In console:

Author

Github: Elifnurdeniz
Mail: [email protected]
Repo: Upstash Ratelimit Plugin

CATEGORY
Tool
VERSION
0.0.1
elifnurdeniz·03/31/2025 08:00 AM
REQUIREMENTS
Tool invocation
App invocation
Endpoint registration
Maximum memory
256MB
Maximum storage
1MB