Skip to main content
OpenAI का billing model AI कंपनियों के लिए gold standard है। यह API usage के लिए prepaid fiat credits को consumer products के flat-rate subscriptions के साथ जोड़ता है। यह hybrid approach predictable revenue सुनिश्चित करती है और developers को बिना रुकावट अपना usage बढ़ाने देती है।

OpenAI का Model Standard क्यों है

AI industry को ऐसी अनोखी चुनौतियों का सामना करना पड़ता है जिन्हें traditional SaaS billing हमेशा संबोधित नहीं करती। OpenAI का model इनमें से कई समस्याओं को एक साथ हल करता है।
  1. Predictable Revenue और Low Risk: API usage के लिए prepaid credits आवश्यक करके OpenAI उन users के massive bills बढ़ाने का risk समाप्त करता है जिन्हें वे चुका नहीं सकते। आपको पैसे पहले मिल जाते हैं और user service का उपयोग करते हुए भुगतान करता है।
  2. Developers के लिए Scalability: $5 का top-up प्रवेश की कम बाधा है। जैसे-जैसे उनका application बढ़ता है, developers top-ups automate कर सकते हैं या बड़े packs खरीद सकते हैं। शुरुआत का friction लगभग शून्य है, लेकिन growth की सीमा असीमित है।
  3. User Psychology: Abstract “tokens” या “points” के बजाय credits को fiat currency (USD) में व्यक्त करने से value स्पष्ट रहती है। यह AI services के लिए bank account जैसा महसूस होता है, जिससे trust बनता है और companies के लिए budgeting आसान हो जाती है।

OpenAI Billing कैसे करता है

OpenAI अलग-अलग user needs के अनुसार दो distinct billing models संचालित करता है।
  1. API (Pay-as-you-go): API prepaid fiat-denominated credits का उपयोग करता है। Users अपने accounts में $5, $10, $50 या उससे अधिक का top-up करते हैं। इन credits में dollar value दिखाई देती है, लेकिन OpenAI के बाहर इनका कोई monetary value नहीं होता। OpenAI input और output tokens के लिए अलग-अलग rates के साथ per-token billing करता है। Credits कभी expire नहीं होते और जब user का balance $0 तक पहुंच जाता है, तो उसकी API calls तुरंत fail हो जाती हैं।
  2. ChatGPT Plus, Team और Enterprise: ये flat-rate subscriptions हैं। ChatGPT Plus की कीमत $20 प्रति माह है, जबकि Team plan की कीमत $25 प्रति user प्रति माह है। इन plans में soft usage caps होते हैं, जहां users को block करने के बजाय छोटे model पर downgrade कर दिया जाता है।
  3. Spend-based rate tiers: समय के साथ कुल अधिक money spend करने पर आप higher API rate limits unlock करते हैं। यह trust-based access scaling system है, जो सीधे आपके billing history से जुड़ा है।

इसे Unique क्या बनाता है

OpenAI की billing strategy में कई प्रमुख विशेषताएं हैं जो इसे AI services के लिए प्रभावी बनाती हैं।
  • Fiat-denominated credits: Credits USD में denominated होने के कारण money जैसे महसूस होते हैं। इससे developers के लिए pricing transparent और समझने में आसान होती है।
  • No expiry: कभी expire न होने वाले balances “use it or lose it” के pressure को कम करते हैं। Users बड़े amounts का top-up करने में सहज महसूस करते हैं क्योंकि उन्हें पता होता है कि value गायब नहीं होगी।
  • Multi-dimensional metering: Input और output tokens को अलग-अलग track किया जाता है, लेकिन deduction एक ही credit balance से होती है। इससे OpenAI महंगे output tokens की pricing सस्ते input tokens से अलग रख सकता है।
  • Trust tiers: Rate limits को total spend से जोड़ने पर users platform पर बने रहने के लिए प्रोत्साहित होते हैं और long-term customers को बेहतर performance मिलती है।

Strategic Advantages

यह model एक powerful flywheel बनाता है। कम entry costs developers को आकर्षित करती हैं। Prepaid credits immediate cash flow प्रदान करते हैं। Usage-based scaling सुनिश्चित करती है कि developers के सफल होने के साथ OpenAI भी सफल हो। Subscription side non-developers से steady और predictable baseline revenue प्रदान करती है।

इसे Dodo Payments के साथ बनाएं

आप Dodo Payments का उपयोग करके OpenAI के billing model को replicate कर सकते हैं। हम API के लिए Credit-Based Billing और ChatGPT Plus side के लिए standard subscriptions का उपयोग करेंगे।
1

Create a Fiat Credit Entitlement

अपने Dodo Payments dashboard में credit entitlement बनाकर शुरुआत करें। यह आपके users के लिए central balance के रूप में काम करेगा।
  • Credit Type: Fiat Credits (USD)
  • Credit Expiry: Never
  • Rollover: Not needed (since they never expire)
  • Overage: Disabled
Overage को disable करने से यह सुनिश्चित होता है कि balance $0 तक पहुंचने पर API calls fail हों, बिल्कुल OpenAI की तरह।
2

Create Top-Up Products

अलग-अलग credit packs के लिए one-time payment products बनाएं। आप $5, $10, $50 और $100 के options दे सकते हैं। प्रत्येक product से अपना fiat credit entitlement attach करें।प्रत्येक product द्वारा जारी किए जाने वाले credits को cents में set करें। $50 pack के लिए आप 5000 credits जारी करेंगे।
3

Create Usage Meters

Token usage track करने के लिए दो अलग meters बनाएं।
  • llm.input_tokens: tokens property पर Sum aggregation।
  • llm.output_tokens: tokens property पर Sum aggregation।
दोनों meters को अपने fiat credit entitlement से link करें। आपको प्रत्येक के लिए “Meter units per credit” configure करना होगा।

Meter Units per Credit की गणना

OpenAI की GPT-4o pricing ($2.50 प्रति 1M input tokens) से match करने के लिए आपको calculate करना होगा कि $1 (100 cents) के बराबर कितने tokens हैं।
  • Input Tokens: 1,000,000 tokens / $2.50 = $1 प्रति 400,000 tokens।
  • Output Tokens: 1,000,000 tokens / $10.00 = $1 प्रति 100,000 tokens।
Dodo dashboard में आप input के लिए “Meter units per credit” को 400,000 और output के लिए 100,000 set करेंगे।
4

Send Usage Events

प्रत्येक LLM request के बाद usage data को Dodo Payments पर भेजें। आप एक ही request में input और output दोनों events भेज सकते हैं।
5

Handle Balance Depletion

API request process करने से पहले user का balance check करना चाहिए। यदि balance zero या negative है, तो 402 error return करें।

Low Balance Webhooks को Handle करना

User के $0 तक पहुंचने का इंतजार न करें। जब balance किसी निश्चित threshold से नीचे गिर जाए, तो email या in-app notification trigger करने के लिए webhooks का उपयोग करें।
OpenAI ये emails तब भेजता है जब user का balance लगभग समाप्त होने वाला होता है, जिससे उन्हें service interruption के बिना top-up करने का समय मिल जाता है।
6

Build the ChatGPT Subscription Side (Optional)

यदि आप ChatGPT Plus जैसा subscription plan देना चाहते हैं, तो Dodo Payments में एक अलग subscription product बनाएं। इनके लिए credit entitlements आवश्यक नहीं हैं।Team plan के लिए प्रत्येक additional user के लिए add-ons जोड़कर seat-based billing का उपयोग करें।

Soft Caps को Implement करना

OpenAI के soft caps को replicate करने के लिए आप अपने subscription users का usage उन्हीं meters का उपयोग करके track कर सकते हैं, लेकिन उन्हें credit entitlement से link न करें। अपने application logic में current billing period का usage check करें।

LLM Ingestion Blueprint के साथ Accelerate करें

ऊपर दिए गए steps दिखाते हैं कि usage events को manually कैसे construct और send किया जाता है। Production deployments के लिए, [LLM Ingestion Blueprint](/developer-resources/ingestion-blueprints/llm automatic token tracking प्रदान करता है, जो आपके OpenAI client को सीधे wrap करता है।
Blueprint प्रत्येक API response से inputTokens, outputTokens और totalTokens capture करता है और उन्हें event metadata के रूप में भेजता है। अपने meter को उपयुक्त token property पर aggregate करने के लिए configure करें।
LLM Blueprint OpenAI, Anthropic, Groq, Google Gemini, OpenRouter और Vercel AI SDK को support करता है। Provider-specific examples और advanced configuration के लिए [full blueprint documentation](/developer-resources/ingestion-blueprints/llm देखें।

Spend-Based Rate Tiers को Implement करना

OpenAI के rate tiers capacity manage करने का एक powerful तरीका हैं। आप customer के total lifetime spend को track करके इसे implement कर सकते हैं।
  1. Track Lifetime Spend: payment.succeeded webhooks को listen करें और उस customer के लिए अपने database में total_spend field update करें।
  2. Define Tiers: Spend amounts और rate limits की mapping बनाएं।
    • Tier 1: $0 - $50 spend -> 3 RPM
    • Tier 2: $50 - $250 spend -> 10 RPM
    • Tier 3: $250+ spend -> 50 RPM
  3. Enforce Limits: अपने API middleware में customer का tier check करें और corresponding rate limit लागू करें।

Full Implementation Example: API Proxy

Real-world scenario में आपके पास संभवतः एक API proxy होगा जो आपके users और LLM provider के बीच बैठता है। यह proxy authentication, credit checks और usage reporting संभालता है।

Edge Cases को Handle करना

OpenAI जितना complex billing system बनाते समय आपको कई edge cases मिलेंगे जिन्हें सावधानी से handle करना आवश्यक है।

Race Conditions

यदि user का balance बहुत कम है और वह एक साथ multiple requests भेजता है, तो पहला event process होने से पहले वह अपनी credit limit पार कर सकता है। इसे रोकने के लिए आप एक छोटा “buffer” implement कर सकते हैं या request के दौरान customer के balance पर distributed lock का उपयोग कर सकते हैं।

Event Ingestion Latency

Dodo Payments events को asynchronously process करता है। इसका अर्थ है कि API call और credit deduction के बीच थोड़ा delay हो सकता है। अधिकांश use cases के लिए यह स्वीकार्य है। यदि आपको strict real-time enforcement चाहिए, तो आप user के balance का local cache maintain करके उसे optimistically update कर सकते हैं।

Refund Handling

यदि आप किसी credit pack purchase का refund करते हैं, तो Dodo Payments configured होने पर credit entitlement को automatically handle करेगा। हालांकि, आपको यह सुनिश्चित करना चाहिए कि आपका application logic इस change को तुरंत reflect करे, ताकि users उन credits का उपयोग न कर सकें जो अब उनके पास नहीं हैं।

Multi-Model Support

यदि आप अलग-अलग pricing वाले multiple models को support करते हैं, तो आपके पास दो options हैं:
  1. Separate Meters: प्रत्येक model के लिए अलग meters बनाएं (जैसे, gpt-4o.input_tokens, gpt-4o-mini.input_tokens)।
  2. Weighted Events: एक single meter का उपयोग करें, लेकिन tokens value को Dodo पर भेजने से पहले weight से multiply करें। उदाहरण के लिए, यदि GPT-4o, GPT-4o-mini से 10x अधिक महंगा है, तो आप GPT-4o requests के लिए tokens की संख्या 10x भेज सकते हैं।
OpenAI usage per model के clear records बनाए रखने के लिए internally separate meter approach का उपयोग करता है।

Architecture Overview

Meters tokens को track करते हैं और configured rates के आधार पर user के credit balance से corresponding value deduct करते हैं।

Conclusion

Dodo Payments के साथ OpenAI के billing model को replicate करने पर आपको दोनों worlds का best मिलता है: usage-based billing की flexibility और prepaid credits की predictability। इस guide का पालन करके आप ऐसा billing system बना सकते हैं जो आपके users के साथ scale हो और आपके margins की सुरक्षा करे। चाहे आप अगला बड़ा LLM बना रहे हों या कोई niche AI tool, ये patterns आपको professional और developer-friendly experience बनाने में मदद करेंगे। यह approach सुनिश्चित करती है कि आपका billing infrastructure उतना ही scalable और reliable हो जितने AI models आप अपने customers को deliver कर रहे हैं।

उपयोग की गई Dodo की मुख्य Features

उन features को explore करें जो इस implementation को संभव बनाते हैं।

Credit-Based Billing

अपने users के लिए prepaid fiat credits और entitlements manage करें।

Usage-Based Billing

Tokens जैसे granular usage को track करें और real-time में उसके लिए bill करें।

One-Time Payments

Simple checkout flow के साथ credit packs और top-ups बेचें।

Event Ingestion

High-volume usage data को आसानी से Dodo Payments पर भेजें।

Webhooks

Credit balance changes और low balance alerts की जानकारी पाते रहें।

LLM Ingestion Blueprint

OpenAI और अन्य LLM providers के लिए automatic token tracking।
अंतिम संशोधन 31 जुलाई 2026