Usage Limits
Usage Limits are controlled by your Payment Provider integration. This allows you to easily link daily and monthly usage of your customers up with the payment provider subscriptions.
Limits
Limits for each Plan are handled via the config/plans.yml
file. In this file you’ll find three example plans, “Free”, “Basic”, and “Pro”.
Limit types
There are two global types that you can limit, total requests and total cost:
total_requests
— The total number of requests of any type that a user can maketotal_cost
— The total spend a user can accumulate in AI fees (in USD).
You can then specify limits on requests and cost for each type of AI API endpoint:
chat_requests
— The total number of requests to the /api/chat endpointchat_cost
— The total cost incurred by querying the /api/chat endpoint
Valid API limit properties are:
chat_requests
chat_cost
tts_requests
tts_cost
image_requests
image_cost
vision_requests
vision_cost
If you don’t want a limit for a specific type of request then you can omit it and it will be considered to be Infinity
. If you want a plan with no limits at all, then you can omit the limits property entirely.
Example
So for example, if you wanted to limit your customers to 10 chat requests and 5 images created per day, but also make sure they don’t exceed US$50 in costs per month you would set the plan like this:
Managing Limits
Usage limits for individual customers can be managed from within the Example App admin section.