लागत = input_tokens / 1,000,000 × 5
+ output_tokens / 1,000,000 × 25Prompt caching इस्तेमाल करने पर reusable context को अलग गिनना होगा: पहली बार 5-मिनट cache में लिखे गए tokens $6.25/MTok, 1-घंटा cache में लिखे गए tokens $10/MTok और बाद के cache hit / refresh $0.50/MTok पर गिने जाते हैं। नया सवाल या नया message, जो cache में नहीं है, सामान्य input rate पर ही charge होता है; model का जवाब output rate पर ही charge होता है।
अगर कोई document सिर्फ एक बार analyze करना है और बाद में follow-up नहीं होने वाला, तो budget आसान है: document, system prompt और user question input tokens में आएंगे; model का answer output tokens में। नीचे के examples Claude API की सार्वजनिक pricing से निकाले गए हैं।
| स्थिति | Input | Output | अनुमानित लागत |
|---|---|---|---|
| छोटा long-document summary | 100k | 5k | करीब $0.625 |
| मध्यम/बड़ा document analysis | 300k | 8k | करीब $1.70 |
| बहुत बड़ा document analysis | 1M | 10k | करीब $5.25 |
उदाहरण के लिए 300k input और 8k output:
300,000 / 1,000,000 × 5 = 1.50
8,000 / 1,000,000 × 25 = 0.20
कुल = 1.70 डॉलरअगर आप किसी पुराने model से Opus 4.7 पर migrate कर रहे हैं, तो पुराने token estimate को जस का तस न मानें। Anthropic की pricing documentation में बताया गया है कि Opus 4.7 नया tokenizer इस्तेमाल करता है, जिससे fixed text के tokens की संख्या अधिकतम 35% तक बढ़ सकती है।
इसलिए अगर पुराना estimate 300k input था, तो conservative हिसाब में इसे 405k input मानना समझदारी होगी। 8k output के साथ:
405,000 / 1,000,000 × 5 = 2.025
8,000 / 1,000,000 × 25 = 0.20
कुल ≈ 2.23 डॉलरLong-document apps में लागत अक्सर output से नहीं, बल्कि हर round में पूरे document को फिर से input की तरह भेजने से बढ़ती है। अगर user उसी document पर कई सवाल पूछेगा, तो prompt caching को budget model में पहले से शामिल करें।
मान लें:
| तरीका | लागत का breakdown | अनुमानित लागत |
|---|---|---|
| पहली बार: 5-मिनट cache बनाना | 300k × $6.25/MTok + 2k × $5/MTok + 2k × $25/MTok | करीब $1.935 |
| बाद में: cache hit | 300k × $0.50/MTok + 2k × $5/MTok + 2k × $25/MTok | करीब $0.21 |
| बिना cache: हर बार पूरा document भेजना | 302k × $5/MTok + 2k × $25/MTok | करीब $1.56 |
इस example में पहली बार cache बनाना, बिना cache वाली single request से महंगा है। लेकिन जैसे ही वही document दूसरी बार use होता है, total cost कम हो जाती है:
बिना cache, दो rounds: करीब 1.56 × 2 = 3.12 डॉलर
5-मिनट cache के साथ, दो rounds: करीब 1.935 + 0.21 = 2.145 डॉलरइसलिए long-document Q&A में सबसे जरूरी metric है cache hit rate: क्या वही document सच में दोबारा पूछा जा रहा है, क्या follow-up cache window के भीतर आ रहे हैं, और क्या हर round में बहुत सारा नया uncached content भी जोड़ा जा रहा है।
Long conversation की cost logic भी लंबी file जैसी ही है। अगर आपकी app हर user turn पर 100k या 200k tokens की पुरानी chat history model को वापस भेजती है, तो input cost तेजी से जमा होगी। जो history stable और reusable है, उसके लिए prompt caching पर विचार करें।
मान लें:
| तरीका | अनुमानित लागत |
|---|---|
| बिना cache: हर round में 200k history + 1k नया message + 2k output | करीब $1.055 / round |
| 200k history को 5-मिनट cache में लिखना: पहली round | करीब $1.305 |
| 5-मिनट cache hit के बाद: हर round | करीब $0.155 / round |
| 200k history को 1-घंटा cache में लिखना: पहली round | करीब $2.055 |
| 1-घंटा cache hit के बाद: हर round | करीब $0.155 / round |
5-मिनट cache या 1-घंटा cache का चुनाव सिर्फ write price देखकर नहीं करना चाहिए। User behavior ज्यादा मायने रखता है:
Batch tasks आम तौर पर offline analysis, data labeling, bulk summarization या बड़े पैमाने की classification में आते हैं। लेकिन जब तक आपके account, contract या cloud endpoint पर लागू batch pricing पक्की न हो, official budget में कोई unverified discount न जोड़ें। Conservative तरीका है कि पहले synchronous API की सार्वजनिक दरों से estimate बनाएं और बाद में actual batch price से उसे revise करें।
Synchronous public-price formula वही रहेगा:
कुल लागत = कुल input tokens / 1,000,000 × 5
+ कुल output tokens / 1,000,000 × 25उदाहरण: 10,000 tasks, हर task में 2k input और 500 output।
कुल input = 10,000 × 2,000 = 20,000,000 tokens
कुल output = 10,000 × 500 = 5,000,000 tokens
input लागत = 20 × 5 = 100 डॉलर
output लागत = 5 × 25 = 125 डॉलर
कुल = 225 डॉलरयह $225 किसी batch discount को जोड़े बिना synchronous public-rate estimate है। अगर बाद में आपके लिए batch pricing या contract pricing confirm हो जाती है, तो इसी model में per-MTok rate बदल दें।
एक और बात: अगर आप Anthropic Claude API को direct call नहीं कर रहे, बल्कि किसी cloud platform या third-party model router से model access कर रहे हैं, तो invoice अलग हो सकता है। Third-party data site CloudPrice Opus 4.7 के लिए Anthropic / global type में $5 input और $25 output per MTok दिखाती है, और कुछ AWS Bedrock regional codes के लिए $5.50 input और $27.50 output per MTok भी दिखाती है। ऐसी जानकारी warning check के लिए उपयोगी है, लेकिन खरीद या production budget के लिए अपने platform billing page, contract और official docs को ही final मानें।
अगर आपके पास अभी real token distribution नहीं है, तो purely theoretical estimate अक्सर कम निकलता है। कम से कम तीन risk factors जोड़ें:
Budget planning के लिए ये non-official safety multipliers उपयोगी हो सकते हैं:
| चरण | सुझाया budget multiplier |
|---|---|
| PoC / trial run | theoretical value × 1.2 से 1.5 |
| production launch, traffic stable | theoretical value × 1.35 से 1.6 |
| पुराने model से Opus 4.7 migration, और भारी long-context usage | theoretical value × 1.5 से 1.8 |
ये multipliers Anthropic की official pricing नहीं हैं; ये budget management के लिए conservative thumb rules हैं। Production के बाद token logs, cache hit rate और invoice data से model को लगातार update करें।
अगर caching नहीं है:
मासिक लागत ≈ daily requests × 30
× (average input tokens / 1,000,000 × 5
+ average output tokens / 1,000,000 × 25)अगर caching है, तो इसे अलग-अलग buckets में तोड़ें:
मासिक लागत ≈ normal input cost
+ cache write cost
+ cache hit / refresh cost
+ output costImplementation से पहले कम से कम ये variables भरें:
| Variable | Example |
|---|---|
| Average input tokens per request | 300,000 |
| Average output tokens per request | 8,000 |
| Daily request count | 1,000 |
| Cache write tokens | प्रति document 300,000 |
| Cache hit tokens | प्रति hit 300,000 |
| Cache hit rate | 60% |
| Tokenizer migration buffer | पहले अधिकतम × 1.35 तक मानें |
| Operating buffer | जैसे × 1.35 से 1.6 |
वही document अगर बार-बार पूछा जाएगा, या लंबी बातचीत में हर round में बड़ी history जाएगी, तो prompt caching का हिसाब पहले करें। 300k document, 2k question और 2k output वाले example में 5-मिनट cache hit की दूसरी round करीब $0.21 है, जबकि हर बार पूरा document भेजना करीब $1.56 बैठता है।
Batch workload में, जब तक real batch pricing, cloud-platform rate या contract price confirm न हो, synchronous API public price से conservative budget बनाएं। और अगर पुराने model से Opus 4.7 पर migrate कर रहे हैं, तो input estimate पर 1.35 तक tokenizer buffer और उसके ऊपर operating buffer जोड़ना, सिर्फ sticker price देखने से ज्यादा यथार्थवादी होगा।
Comments
0 comments