
Cross-Model LLM Pricing API
An API that calculates the cost and breakdown of an LLM call from its response.
以下正文同步自 Hacker News 最新,版权归原站所有,已转换为易读排版。
An API that calculates the cost and breakdown of an LLM call from its response.
Copy promptCopied View promptHide prompt Coding agent setup promptAdd per-call LLM costs to this project using Metergraph's free Pricing API. No account, API key or SDK is needed.
Read https://www.metergraph.dev/docs/reference/pricing-api/ for the contract. Find where this project receives model and usage data, including final usage for streamed responses. Keep the existing provider clients.
From server-side code, use POST https://app.metergraph.dev/v1/pricing/calculate with a JSON body containing a trace object. The API has no browser CORS support. For a browser-only project, explain the backend route it needs.
Send model, usage and billing metadata without prompt or response text. Keep the provider's response format or set format as the docs describe. Include billing channel, region and service tier only when known; gateway rates can differ from direct provider rates.
Record the cost and breakdown using this project's conventions. Keep decimal precision and distinguish priced, partial and unpriced results. Never treat missing costs as zero. Use bounded timeouts and respect Retry-After. Pricing failures must not break the LLM call.
Test with synthetic usage and run the relevant project checks. Show what changed and where the costs appear.
Enable JavaScript to use the playground, or use the Pricing API directly.
Calculate a response to see its cost and the rates behind it.
Run a request to view its response.
Lower your LLM costs with Metergraph
Start saving now
Spend by workflow
Translation
Summarization
Data extraction
Find your biggest savings
See where a cheaper model could cut your bill the most.
Compare the answers and cost on requests from your own app.
model:- "claude-sonnet-5-5"+ "gpt-6-luna"
Review the proposed change
Let your coding agent make the change. Review the diff before you ship.
正文由 探How 从来源站点 RSS 同步,内容未经改写;遇到排版缺失或需要图片、视频时请以原文为准。