The Core Concept: The Unified Credit ModelThe key to this setup is to separate what the customer buys from what they use.
-
What They Buy: Customers will purchase a single feature called
Prepaid API Credits
. This is the only item with a direct dollar cost, sold in packages (e.g., $100 for 100 credits). -
What They Use: We will create individual
Metered
features for every billable OpenAI service (e.g.,GPT-4o Input Tokens
,DALL-E 3 Images
). These features track consumption but have no price directly attached to them in the plan. -
The Logic: At the end of a billing cycle, your backend will calculate the total monetary cost of all services used. You will then deduct the equivalent amount from the customer’s
Prepaid API Credits
balance.
Step 1: Create the Central “Prepaid API Credit” Feature
This feature represents the wallet or balance that customers purchase.- Navigate to Product Catalog > Feature entitlements.
- Click + Create feature.
- Fill in the details for the credit feature:
- Feature name:
Prepaid API Credits
- Feature type: Select
Metered
. - Meter source: Choose Raw.
- Feature unit: Enter
Credit
for the singular form andCredits
for the plural form. (In this model, 1 Credit = $1.00 USD).
- Feature name:
- Click Create.
Step 2: Create All Billable Service Features
Now, create a separateMetered (Raw)
feature for every distinct service OpenAI offers. These will be used for tracking usage only.
- Language Models
- Image Models
- Audio Models
GPT-4o
- On the “Feature entitlements” page, click + Create feature.
- Enter the details for GPT-4o Input:
- Feature name:
GPT-4o - Input Tokens
- Feature type:
Meter
>Raw
- Feature unit:
Token
/Tokens
- Feature name:
- Click Create.
- Click + Create feature again for GPT-4o Output:
- Feature name:
GPT-4o - Output Tokens
- Feature type:
Meter
>Raw
- Feature unit:
Token
/Tokens
- Feature name:
- Click Create.
Metered (Raw)
features for other language models like GPT-4 Turbo - Input Tokens
, GPT-3.5 Turbo - Input Tokens
, etc., as needed.Step 3: Create the Product and Plan
Create a single product and plan that will serve as the vehicle for selling the credit packages.- Navigate to Product Catalog > Products and click + Create product.
- Product name:
OpenAI API Services
- Subscription type: Select Single active subscription.
- Product name:
- Click Create.
- On the new product’s page, click + Create plan.
- Plan name:
Prepaid Credits
- Description:
Pre-purchase credits to use across all OpenAI services.
- Plan name:
- Click Create.
Step 4: Configure the Credit Packages
Here, we will configure the pricing for thePrepaid Credits
plan. The user will be on a monthly billing cycle for invoicing, but will only be charged when they purchase a credit package.
- On the
Prepaid Credits
plan page, click Set price. - Select the Paid plan type.
- On the “Billing cycle” screen, you must select a cycle. Choose Monthly and click Continue.
- On the “Charges” screen, do not add a “Fixed Charge”. This sets the recurring subscription fee to $0.
- Click Add usage-based charges.
- Choose the Prepaid API Credits feature.
- Select Prepaid commitment. This is the critical step to ensure customers are billed upfront for the credits.
- For the “Pricing model,” select Package.
- Configure your first package:
- Price:
$20
- per package:
20
units
- Price:
- Click Add.
- Repeat the process to add other packages (e.g., 100 for 100 credits).
- Save the pricing configuration and Publish the plan.
Step 5: Implement the Billing Logic
With the setup complete, the final step is to implement the backend logic that connects service usage to the prepaid credit balance.Implementing the Credit Deduction Logic
Implementing the Credit Deduction Logic
- Customer Purchase: A user goes to your pricing page and purchases the “100 for 100 credits” package. Because you selected “Prepaid commitment,” they are charged 100 immediately. Their Prepaid API Credits balance in ParityDeals is now 100.
-
Service Consumption: The user makes various API calls. Your application sends usage events to ParityDeals for each service feature (e.g.,
GPT-4o - Input Tokens
,DALL-E 3 - Standard Image
). - End-of-Cycle Calculation: At the end of the billing period, your backend logic runs.
-
Fetch Usage Data: You call the ParityDeals API to get the total usage for that customer for each service feature.
GPT-4o - Input Tokens
: 2,000,000 tokensDALL-E 3 - Standard Image
: 50 images
-
Calculate Monetary Cost: Your backend applies the public OpenAI prices to the usage data.
- Tokens Cost:
2,000,000 tokens * ($5.00 / 1,000,000 tokens) = $10.00
- Images Cost:
50 images * ($0.040 / image) = $2.00
- Total Cost:
$10.00 + $2.00 = $12.00
- Tokens Cost:
-
Deduct from Credit Balance: You then report a usage of
12.00
for thePrepaid API Credits
feature for that customer. Their balance will be reduced from100
to88
. This deduction is what appears on their ParityDeals invoice.