Skip to content

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”.

config/plans.yml
default_plan_id: 1
plans:
- name: Basic
id: 1
price: 19
price_id: <price_id>
checkout_url: <checkout_url>
# Array of features to show on the plans page
features:
- 100 daily requests
- All AI providers
- Email support
# API limits for daily or monthly usage
# can omit limits that are not required
limits:
daily:
total_requests: 100
total_cost: 10
monthly:
total_requests: 1000
chat_requests: 100
tts_requests: 100
image_requests: 50
vision_requests: 50

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 make
  • total_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 endpoint
  • chat_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:

limits:
daily:
chat_requests: 10
image_requests: 5
monthly:
total_cost: 50

Managing Limits

Usage limits for individual customers can be managed from within the Example App admin section.