Getting Started with Pay-i
Thank you for being an early customer of Pay-i!
Overview
This documentation will describe Pay-i concepts, functionality, and code to get you up and running quickly.
At any time, you can send mail to [email protected] to report issues, ask questions, or get help.
🚀 Quickstart
Instrument your GenAI provider calls with Pay-i to automatically track costs, manage budgets, analyze usage patterns, and much more! This quickstart will guide you through the complete process from creating an application to viewing your tracked events.
1️⃣ Create an Application in Pay-i Developer Portal
Before you begin coding, you'll need to set up your application and get your API key:
-
Log in to developer.pay-i.com
-
Click on Private Apps button in the top-left corner
-
Click on +Create Application button in the top-right corner
-
Enter an application name (e.g., "Quickstart") and select a group
-
Once created, new App Settings will open automatically. Under the API section, copy your Primary API Key for use in the next steps
Note about Groups: Each user gets their own personal group for private applications that aren't shared with others. If you need to share applications with team members, you'll need to move them to a shared group. Groups help organize related applications and provide aggregated metrics.
Note: For more details on applications, see the Applications documentation.
2️⃣ Install SDK
Install the Pay-i SDK along with your AI provider's SDK. We will use OpenAI as an example:
pip install --upgrade payi openai
%pip install --upgrade payi openai
3️⃣ Set API keys
Create a .env
file in your project directory (recommended):
- Install python-dotenv:
pip install python-dotenv
- Create a
.env
file with your API keys:
OPENAI_API_KEY=sk-... # Your OpenAI API key
PAYI_API_KEY=api-... # Your Pay-i API key from step 1
- Add
.env
to your.gitignore
file to prevent accidentally committing your API keys.
For non-Python environments or alternatives, see Environment Variables.
4️⃣ Set up Pay-i Instrumentation
Initialize Pay-i instrumentation to track your GenAI usage:
import os
from dotenv import load_dotenv
from openai import OpenAI
from payi.lib.instrument import payi_instrument
# Load environment variables from .env file
load_dotenv()
# Initialize Pay-i instrumentation
payi_instrument()
# Initialize OpenAI
client = OpenAI()
5️⃣ Use normally
Make API calls as usual with the configured client:
response = client.chat.completions.create(
model="gpt-3.5-turbo",
messages=[{"role": "user", "content": "Hello, world!"}]
)
print(response.choices[0].message.content)
6️⃣ View Your Events
After running your code, you can view your tracked events:
- Return to developer.pay-i.com
- Select your application (created in step 1)
- View your request activity, including costs and usage details in the dashboard
Note: While Pay-i tracks the data in real-time, the dashboard does not update in real-time to prevent the data from shifting while you are viewing an app with live traffic. Each page has a "Refresh Data" button to bring in the latest data.
Tip
Looking for more features? Check out:
- Environment Variables - For secure configuration using PAYI_API_KEY and PAYI_BASE_URL
- OpenAI Quickstart - Shows limits, analytics tags, streaming, and more
- Azure OpenAI Quickstart - Same features for Azure OpenAI Service
📚 Example Notebooks
We have several Python notebooks that make it very easy to get up and running with popular Providers.
You can find the notebooks on our GitHub: Pay-i Quickstarts.
We suggest reading through the Pay-i Concepts section at a minimum, which will help you get the most out of Pay-i.
🛠️ Provider Configuration
We provide detailed guides for configuring Pay-i with popular LLM providers:
For a more general overview, check out our Auto-Instrumentation guide.
🧩 Decorators
Our Python Decorators provide an easy way to enhance Pay-i with business context, letting you annotate your functions with metadata that gets passed to Pay-i. This feature is currently only available in our Python SDK. If you would like to see this added for a different language, please contact [email protected].
📖 Interactive API Docs
Head on over to our API Reference to use our interactive API documentation. It requires a Pay-i API key, which you can learn more about in the Authentication section.
We're excited you're here! 💚

Updated 16 days ago