Revenue Setup
Step-by-step guide to billing your customers for AI usage — from enabling billing to collecting your first payment.
This guide walks you through setting up Revenue from scratch. By the end, you'll have plans, markup pricing, and Stripe payments — all managed from the Cencori dashboard.
No code is required for the setup. Your engineering team only needs to integrate later (and it's minimal).
Before You Start
You need:
- A Cencori account with a project created
- Admin or owner access to the organization
- A Stripe account (for collecting payments — can be set up during this guide)
Step 1: Turn on usage billing
- Open your project in the Cencori dashboard.
- Go to AI Gateway → Revenue. You'll land on the Overview tab.
- In the Usage billing card, turn the switch on.
- Click Save changes.
That's it — billing is now active for this project.
Step 2: Set Your Default Markup
While still in the Usage billing card:
- Find the Default markup field.
- Enter your desired markup. This is the percentage you add on top of the AI provider's cost.
How to think about markup:
This default markup applies to all customers who don't have a plan with its own markup. You can override it per plan.
- Choose a Billing cycle (monthly is standard for most products).
- Click Save changes.
Step 3: Create Your First Plan
Plans define what each tier of customer gets — their limits, their pricing, which models they can access.
-
Switch to the Plans tab.
-
Click Create plan (top right).
-
Fill in the basics:
- Name: Something your team understands (e.g. "Free Tier", "Pro", "Enterprise").
- Slug: A URL-friendly version (e.g.
free,pro,enterprise). Used in the API. - Currency: The currency the plan bills in.
-
Set the limits. Start simple — you can always adjust later:
For a Free tier:
For a Pro tier:
- Turn on Default plan for the plan you want new customers to start with (usually your Free tier).
- Click Create plan.
Repeat for as many tiers as you need.
What Each Setting Does
- Token limits (daily/monthly): Caps how many tokens (input + output) a user can consume. One token is roughly 4 characters of English text.
- Request limits (daily/monthly): Caps how many API calls a user can make.
- Requests per minute: Burst protection. Prevents a single user from hammering your API.
- Cost limits (daily/monthly USD): Hard cap on spend. Useful if you offer unlimited requests but want to cap dollar exposure.
- Provider cost markup: Your margin on top of the AI provider's cost. Overrides the project default.
- Platform commission: Cencori's fee — a percentage of your profit on each request (what you charge the customer minus the provider cost). Defaults to 20%.
- Flat rate per request: A fixed fee added to every request on top of the usage-based charge. Good for premium models.
- Allowed models: Restrict which AI models this tier can access. Leave empty to allow all.
- When a limit is reached:
- Block further requests: Stops requests when limits are hit. Gateway requests return
429 Too Many Requestswith aRetry-Afterheader. If you usecheck-quotadirectly, it returnsallowed: false. - Continue and send an alert: Lets requests through but flags the overage. Good for monitoring before enforcing.
- Block further requests: Stops requests when limits are hit. Gateway requests return
The Plans tab lists every plan in a table. Click a plan to edit it.
Step 4: Connect Stripe
This lets you collect real payments from your end-users.
Stripe Connect is organization-scoped. Connecting it once makes it available to every project in the same organization.
- Go back to the Overview tab.
- Under Payment providers, find the Stripe card.
- Click Connect.
- You'll be redirected to Stripe to complete onboarding:
- If you have a Stripe account: Sign in and authorize Cencori.
- If you don't: Stripe will walk you through creating one (takes ~5 minutes).
- Once done, you'll be redirected back to the dashboard.
- The card should now show Connected and Ready to collect payments. If it shows Action required, click Complete setup to finish onboarding in Stripe.
Stripe Connect uses the "Standard" model. Your customers pay you directly. Cencori never touches the funds. You manage payouts, refunds, and disputes from your own Stripe dashboard.
Step 5: Understand How Customers Appear
Customers show up in the Customers tab. A customer is created automatically the first time usage is recorded for them — after a successful gateway request that includes their user ID, or a Usage Events API write. A quota check by itself does not create the customer. There is no button to add customers by hand; to create them ahead of usage, use the End Users API (/v1/end-users).
Managing Customers
From the Customer directory on the Customers tab, you can:
- Search by name, email, or external ID
- Filter by plan or status (active/blocked)
- Block or unblock a customer — blocking immediately stops all their requests
- Assign a plan — open a customer's row to upgrade or downgrade them anytime
- View usage — open a customer's row to see their daily requests, tokens, and cost for the last 7 days
Step 6: Hand Off to Engineering
The dashboard setup is done. Now your engineering team needs to integrate — and it's minimal.
If you use the Cencori AI Gateway (recommended):
Your engineers change one line of code. Instead of calling OpenAI/Anthropic directly, they point to Cencori and pass the user ID:
// Before — calling OpenAI directly
const client = new OpenAI({ apiKey: "sk-..." });
// After — one line change, everything else stays the same
const client = new OpenAI({
apiKey: "csk_your_cencori_key",
baseURL: "https://api.cencori.com/v1",
});
// Pass the user ID in requests
const response = await client.chat.completions.create({
model: "gpt-4o",
messages: [{ role: "user", content: userMessage }],
user: "user_123", // this maps to end_user_id
});That's it. Billing, rate limits, quotas — all handled automatically.
If you have your own AI infrastructure:
Your engineers add two API calls — one before processing (quota check) and one after (usage report). See the Revenue API Reference for the full integration guide.
Step 7: Generate Invoices
Once you have usage data, you can generate invoices for your customers:
- Switch to the Invoices tab.
- In the Invoices card, click Generate invoices.
- The invoice period ends today and starts yesterday (daily cycle), seven days ago (weekly), or on the first day of last month (monthly). Customers with no usage, or who already have an invoice for that period, are skipped.
- If Stripe is connected, optionally turn on Send via Stripe to create and finalize Stripe invoices for customers with an email address.
- Click Generate.
Invoice statuses update automatically: draft when generated, sent when dispatched via Stripe, paid when payment is received, and overdue if payment fails.
Step 8: Monitor Revenue
Once traffic starts flowing, the Invoices tab also shows your revenue:
- Customer revenue, Provider cost, Margin, and Margin rate over time
- Revenue and cost — daily revenue compared with provider spend
- Top customers — who's spending the most
Use the period selector (7 days / 30 days / 90 days) to zoom in or out.
Exporting Data
Click Export on the Invoices tab to download revenue data as CSV or JSON. Use this for:
- Reconciling with your own billing system
- Generating custom invoices
- Financial reporting
Quick Reference
What Happens When a Customer Hits Their Limit?
It depends on When a limit is reached in their plan:
- Block further requests: Gateway requests return a
429error with aRetry-Afterheader and a JSON body explaining which limit was hit. If you callcheck-quotadirectly, it returnsallowed: falsewith areasonfield andretry_after_seconds. - Continue and send an alert: Everything works normally, and the overage is flagged. Good for monitoring before enforcing.
Common Questions
Can I change a user's plan mid-cycle? Yes. Changes take effect immediately. The new limits apply from that moment — usage already consumed in the current period still counts.
What if I don't set up Stripe? Everything else still works — quota enforcement, usage tracking, the dashboard. You just won't be collecting payments through Cencori. You can use the exported data to bill through your own system.
Do users need to create a Cencori account? No. End-users are your customers. They never interact with Cencori directly. Everything goes through your app.
Can I have different markup for different plans? Yes. Each plan has its own markup percentage. The project default is just a fallback for customers without a plan-specific markup.
Do test-environment requests count against production limits? No. Quota checks and usage aggregation are scoped by API key environment. Test-key traffic is tracked separately from production-key traffic.
Next Steps
- Revenue API Reference — technical documentation for your engineering team
- Cost Optimization — reduce your AI costs before applying markup
- Rate Limiting — project-level rate limits (separate from per-user limits)
- Audit Logs — track who changed billing settings and when

