{"uid":"cap_h-8NXOIvwpQFLij61wIXd","slug":"llm-cost-quote-api-fd8e21d0","name":"LLM Cost Quote API","description":"41 pay-per-call JSON APIs for AI agents. No account or API key: an unpaid POST returns HTTP 402, pay in USDC on Base with x402 v2, retry. Prices from $0.001 per call.","url":"https://x402-micro-pay.com/api/skills/llm-cost-quote?utm_source=zero.xyz","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"top":{"type":"integer","default":10,"maximum":50,"minimum":1},"text":{"type":"string","maxLength":400000},"models":{"type":"array","items":{"type":"string","maxLength":120},"maxItems":25},"request_id":{"type":"string","pattern":"^[A-Za-z0-9._:-]+$","maxLength":64,"minLength":1,"description":"Optional idempotency key. Echoed back; a credit-pack redemption with the same request_id and body is charged once."},"include_free":{"type":"boolean","default":false},"input_tokens":{"type":"integer","maximum":10000000,"minimum":0},"output_tokens":{"type":"integer","default":500,"maximum":1000000,"minimum":0}}},"responseSchema":{"type":"json","example":{"ok":true,"data":{"quotes":[{"name":"OpenAI: GPT-4o-mini","model":"openai/gpt-4o-mini","cost_usd":"0.00069","fits_context":true,"context_length":128000,"time_based_price":false,"input_usd_per_mtok":"0.15","output_usd_per_mtok":"0.6"},{"name":"Google: Gemini 2.5 Flash","model":"google/gemini-2.5-flash","cost_usd":"0.0019","fits_context":true,"context_length":1048576,"time_based_price":false,"input_usd_per_mtok":"0.3","output_usd_per_mtok":"2.5"}],"currency":"USD","input_tokens":3000,"token_source":"caller-supplied input_tokens","output_tokens":400,"missing_models":[],"price_fetched_at":"2026-10-17T11:12:57Z","models_considered":2},"next":["token_count"],"skill":"llm_cost_quote","charged":true,"service":"llm_cost_quote","sources":[{"url":"https://openrouter.ai/api/v1/models","name":"OpenRouter public models list","fetched_at":"2026-10-17T11:12:57Z"}],"summary":"cheapest: openai/gpt-4o-mini $0.00069 for 3000 in + 400 out tokens","version":"1.0.0","warnings":[],"confidence":0.97,"data_as_of":"2026-10-17T11:12:57Z","generated_at":"2026-10-17T11:12:57Z"}},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.0034","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","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.0034/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.0034","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.0034","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_ZOjJ8b4txZkFMHZGWVc2J","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.0034","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Returns price quotes (cost in USD) for one or more LLM models given an estimated token count, ranking them by cost.","exampleAgentPrompt":"What's the cheapest LLM model to handle a prompt with about 5000 input tokens and 500 output tokens — show me the top 5 options and whether they fit the context window?","exampleUseCases":[{"title":"Pre-call cost check for agent pipeline","prompt":"Before I run this 8000-token document through an LLM, show me the top 3 cheapest models that can handle it with 500 output tokens, so I can pick the most cost-effective one."},{"title":"Budget comparison across specific models","prompt":"Compare the cost of running openai/gpt-4o-mini, google/gemini-2.5-flash, and anthropic/claude-3-haiku for a job with 2000 input tokens and 200 output tokens — which is cheapest?"},{"title":"Discover free models for a given token count","prompt":"Show me all the free LLM models that can handle 1000 input tokens and 300 output tokens, including ones that might normally be paid."}],"resultDescription":"A ranked list of LLM model quotes, each with total cost in USD, per-million-token input/output pricing, context length, and a flag for whether the token count fits. Also returns a plain-English summary of the cheapest option, the token counts used, data freshness timestamp, and any models not found.","failureModes":["HTTP 402 returned if x402 payment not included — must pay 0.0034 USDC on Base before retrying","input_tokens or output_tokens out of range returns validation error","models array contains unknown model IDs — those appear in missing_models list","text field too long (>400,000 chars) triggers payload rejection","top value exceeds 50 — clamped or rejected","Stale pricing if OpenRouter data is temporarily unavailable"],"whenToPreferThis":"Use this endpoint when an AI agent needs to select or budget for an LLM call before making it — especially useful for cost-aware routing, multi-model comparison, or when optimizing spend across a pipeline. Prefer this over manually checking OpenRouter docs when you need a programmatic, always-fresh quote that includes context-fit filtering. Ideal when you have a specific token budget and want the cheapest model that fits.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-11-20T12:44:27.104Z","isFirstParty":false,"canonicalSlug":"llm-cost-quote-api-fd8e21d0"}