Replicate Algolia's pay-as-you-go pricing

Discover how Algolia, the search and discovery platform, increases conversion with commitment-free pricing options that adapt to customers’ needs.

What's in it for you?

In this article, you will learn how to build a ‘pay-as-you-go’ billing system.

This template is suitable for companies whose pricing fully depends on usage, such as cloud service providers and API companies, that only charge their customers for the resources they consume.

What's the secret sauce?

For its two main products, Algolia Search and Algolia Recommend, the platform offers its customers to subscribe for free and only pay based on usage.

Search API
Recommend API
Monthly price
$1.50 / 1,000 requests
$0.60 / 1,000 requests
Free usage (each month)
10,000 requests
10,000 requests

Although users don’t need to subscribe to access the platform, Algolia offers its customers discounts based on volume and commitment (rates available upon request).

We are going to teach you how to replicate this pricing with our billing solution.

What do you need?

The first thing to do is to create your company account on Lago Cloud or deploy Lago Open Source on your existing infrastructure. In both cases, you should ask a back-end developer to help you with the setup.

Our documentation includes a step-by-step guide on how to get started with our solution.

Instruction manual

Step 1 – How to calculate the number of requests

Lago monitors consumption by converting events into billable metrics. For Algolia, there would be two billable metrics based on the number of requests for the Search and Recommendation APIs.

As the platform handles high volumes of requests, it would be inefficient to create an event each time a request is made. Instead, Algolia could simply send an event once an hour or hour a day with the total number of requests.

How to create a billable metric using the 'sum' aggregation type

Through the user interface, we have created two billable metrics called ‘Search requests’ and ‘Recommend requests’. For these metrics, we use the ‘sum’ aggregation type based on the volume of requests.

At the end of the billing period, Lago will calculate the sum of requests for each metric using the value of each event (i.e. the event property).

Step 2 – How to create a plan with multiple charges

Now that we have all our billable metrics, we can replicate Algolia’s pricing. As this is a ‘pay-as-you-go’ plan, there is no subscription fee. In the plan settings, we can simply define a monthly billing period and then add our charges.

How to create packages

For both charges, we use the package pricing model. This model allows us to create packages of units and define a unique package price. Customers will be charged for usage based on packages of 1,000 requests. Algolia offers 10,000 requests for free each month, for both APIs. Beyond this limit, each ‘opened’ package is due, which means that 800 Search requests cost the same price as 1,000 requests (i.e. $1.50).

At the end of each billing period (i.e. each month), Lago will automatically invoice each customer according to their consumption, then all counts and calculations will be reset to zero for the next period.

Step 3 – How to offer volume and commitment discounts

“When committing to the equivalent of 100 Search units per month or more, you automatically unlock a discount compared to PAYGO. Please contact sales for more information.”

Algolia doesn't provide much information about their volume and commitment discounts but we know that customers who commit to making at least 100,000 Search requests per month (for Algolia, a “Search unit” is a package of 1,000 requests) can benefit from a reduced price.

We are going to make some assumptions to see how we could implement this logic.

If we want to keep our package pricing model, we should convert the commitment part of our plan into a subscription. With the standard pricing, 100,000 requests would be charged $150 (i.e. 100 packages of 1,000 requests at $1.50 each). Since we want to offer a discount to our customers, an option would be to create a monthly subscription of $120 and then set the package price to $1.20 with 100,000 free requests per month (i.e. those included in the subscription).

How to create a subscription

Another option would be to drop the package pricing model and remove the subscription to use the graduated pricing model. This model would allow us to create several tiers with different unit prices. We could define a flat fee for our first 100,000 requests (i.e. committed usage) and then apply a decreasing unit price to offer a volume discount.

How to apply volume discounts

Wrap-up

‘Pay-as-you-go’ pricing strategies are popular among API companies like Algolia.

With Lago, you can adapt this template to your products and services, using some of our most popular features:

  • Plan models, with or without subscription;
  • Billable metrics, including the ‘sum’ aggregation type; and
  • Charges, including our package and graduated pricing models.

Give it a try, sign up here to get early access to Lago.

Want to talk to our team?