{"uid":"cap_L6fYe6yfUYW8odRW9zFSb","slug":"api-strale-io-1bf6eb4a","name":"LLM API Cost Calculator","description":"Calculate LLM API cost for a prompt+completion across 14 models. Returns cheaper alternatives with savings percentages. Algorithmic.","url":"https://api.strale.io/x402/llm-cost-calculate?utm_source=zero.xyz","method":"GET","headers":{},"bodySchema":{"type":"object","$schema":"https://json-schema.org/draft/2020-12/schema","required":["input"],"properties":{"input":{"type":"object","required":["type","method"],"properties":{"type":{"type":"string","const":"http"},"method":{"enum":["GET","HEAD","DELETE"],"type":"string"},"queryParams":{"type":"object","required":["model"],"properties":{"model":{"type":"string"},"prompt_text":{"type":"string"},"prompt_tokens":{"type":"integer"},"completion_text":{"type":"string"},"completion_tokens":{"type":"integer"}}}},"additionalProperties":false}}},"responseSchema":null,"example":{"request":{"model":"gpt-4o","prompt_text":"Summarize the following document in 3 bullet points: Artificial intelligence is transforming industries by automating tasks and improving decision-making processes.","prompt_tokens":500,"completion_tokens":150},"response":{"_meta":{"payment":{"method":"x402","price_usd":0.0216,"settlement_id":"0x598fad3712b4ddb172a6f99f93d49c757856dfd09087281833ed51345c35e169"},"capability":"llm-cost-calculate","latency_ms":0,"provenance":{"source":"algorithmic","fetched_at":"2026-06-13T04:25:42.340Z"}},"model":"gpt-4o","cost_usd":0.00275,"input_tokens":500,"total_tokens":650,"model_pricing":{"input_per_1k":0.0025,"output_per_1k":0.01},"output_tokens":150,"context_window":128000,"cheaper_alternatives":[{"model":"gemini-1.5-flash","cost_usd":0.000083,"context_window":1000000,"savings_percent":97},{"model":"gpt-4o-mini","cost_usd":0.000165,"context_window":128000,"savings_percent":94},{"model":"claude-3-haiku","cost_usd":0.000313,"context_window":200000,"savings_percent":89},{"model":"llama-3-70b","cost_usd":0.000414,"context_window":8192,"savings_percent":85},{"model":"gpt-3.5-turbo","cost_usd":0.000475,"context_window":16385,"savings_percent":83}]}},"exampleRequest":{"model":"gpt-4o","prompt_text":"Summarize the following document in 3 bullet points: Artificial intelligence is transforming industries by automating tasks and improving decision-making processes.","prompt_tokens":500,"completion_tokens":150},"tags":["x402"],"displayCostAmount":"0.0216","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"settled","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.0216/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.0216","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.0216","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_QifF5w1dDl_68U1Yu9tHV","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.0216","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Calculates the API cost for a given LLM prompt and completion across 14 models, returning cheaper alternatives with savings percentages.","exampleAgentPrompt":"How much would it cost to run this prompt on gpt-4o: 'Summarize the following document in 3 bullet points' with about 500 prompt tokens and 150 completion tokens, and show me cheaper alternatives with their savings?","exampleUseCases":null,"resultDescription":"Returns the estimated cost for the specified model and prompt/completion, plus a ranked list of up to 14 alternative models with their costs and percentage savings relative to the chosen model.","failureModes":["Missing required 'model' query parameter returns a validation error","Unrecognized model name may return null cost or an error","Providing neither prompt_text/completion_text nor token counts may result in a zero-cost estimate","Network or payment failure (402) if USDC payment is not provided or fails"],"whenToPreferThis":"Use this endpoint when an agent or developer needs to compare LLM API pricing across multiple models for a given input size, or wants to identify cost-saving alternatives to a currently used model. Ideal for cost optimization workflows and budget estimation before scaling LLM usage.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-12T18:50:53.436Z","isFirstParty":false,"canonicalSlug":"api-strale-io-1bf6eb4a"}