AI Rate Limiting Advanced Policy

Enable rate limiting with multiple conditions

Protect your LLM services with rate limiting based on multiple conditions. The AI Rate Limiting Advanced Policy analyzes query costs and token responses to provide an enterprise-grade rate limiting strategy.

In this example, we’re enabling rate limiting for a specific AI Consumer using the OpenAI provider. The limits specified only apply when both conditions are met. When the limit is reached, the same AI Consumer may be able to send requests to a different provider.

Prerequisites

Environment variables

  • CONSUMER_USERNAME: The username of the AI Consumer to rate limit.

Set up the policy

Attach the policy

Help us make these docs great!

Kong Developer docs are open source. If you find these useful and want to make them better, contribute today!