Quickstart

Get started with Limitry in 5 minutes

Get up and running with Limitry in just a few minutes.

Prerequisites

  • A Limitry account (sign up here)
  • An API key from your project settings
  • Node.js 18+ or Python 3.8+

Step 1: Install the SDK

npm install @limitry/sdk
pip install limitry

Step 2: Track Your First Event

import { Client } from '@limitry/sdk';

const client = new Client({
  apiKey: 'your-api-key',
});

await client.track.trackUsage({
  customerId: 'customer_123',
  eventType: 'model_call',
  model: 'gpt-4',
  provider: 'openai',
  inputTokens: 100,
  outputTokens: 50,
  totalTokens: 150,
});
import asyncio
from limitry import Client

async def main():
    async with Client(api_key="your-api-key") as client:
        await client.track.track_usage(
            customer_id="customer_123",
            event_type="model_call",
            model="gpt-4",
            provider="openai",
            input_tokens=100,
            output_tokens=50,
            total_tokens=150,
        )

asyncio.run(main())

Step 3: Check Quotas

const result = await client.quotas.check({
  customerId: 'customer_123',
  eventType: 'model_call',
});

if (result.allowed) {
  // Proceed with the request
} else {
  // Quota exceeded
}
result = await client.quotas.check(
    customer_id="customer_123",
    event_type="model_call",
)

if result.allowed:
    # Proceed with the request
else:
    # Quota exceeded

What's Next?

On this page