Checking Quotas

Check usage quotas with the TypeScript SDK

Check if a customer has exceeded their usage quota.

Check Quota

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

if (result.allowed) {
  // Proceed with the request
} else {
  // Quota exceeded
  throw new Error('Quota exceeded');
}

Next Steps

On this page