Guides

Requests

Overview

In Pay-i, a Request refers to an API call to a Provider, such as getting a chat completion from Anthropic or generating an image with DALL-E. Requests are the fundamental unit of tracking in the Pay-i system and serve as your statement of record for all GenAI interactions.

The Core of Pay-i Tracking

Requests form the backbone of Pay-i's tracking and analytics system. Each request represents a discrete API call that Pay-i captures, enriches, and analyzes. When Pay-i instruments a request, it records much more than just cost:

  • Usage metrics: Tokens, images, or other resource consumption
  • Performance data: Response times, latency statistics
  • Cost information: Calculated based on the latest Provider pricing
  • Success/failure status: Whether the API call completed successfully
  • Semantic information: Use cases, user IDs, custom properties
  • Limit tracking: How the request affects your defined budgets and quotas

This comprehensive data collection makes requests the central element in Pay-i's monitoring, analytics, and control capabilities.

How Pay-i Works with Requests

Your application communicates directly with the GenAI provider, while Pay-i captures metrics asynchronously:

Your App → GenAI Provider
       ↓
     Pay-i

This approach provides:

  • Minimal latency impact
  • No direct dependency on Pay-i for request success
  • Comprehensive usage tracking
  • Support for all Pay-i analytics features