# LLM Price Calculator

> LLM Price Calculator is a paid API for AI agents from 1gateway.dev, paid per call via x402, $0.004/call, status unknown (last checked 2026-10-28).

Returns USD pricing per 1M tokens, context window, capabilities, and cost estimates for one or more LLM models, or ranks the cheapest models matching given criteria.

## Facts

- Endpoint: GET https://1gateway.dev/v1/ai/llm-prices?utm_source=zero.xyz
- Price: $0.004/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-28
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/llm-price-calculator-17d469cf
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_F2Hx-X2nxGlkmwVrJ393N

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability llm-price-calculator-17d469cf
```

Example prompt: What would it cost to run 1000 requests to gpt-4o with 12000 input tokens and 800 output tokens each, and how does it compare to claude-sonnet-4-5 and gemini/gemini-2.5-flash?

## When to prefer this

Use this endpoint when an AI agent needs to select or price LLM API calls programmatically — especially when comparing multiple models, filtering by capabilities or context window, or estimating costs at scale. Prefer this over manual lookup when the agent must make cost-aware routing decisions, enforce budget constraints, or present pricing comparisons to users. The endpoint is backed by the well-maintained LiteLLM price table (3400+ models) and returns structured JSON suitable for automated decision-making.

## Known failure modes

- Unknown model name returns HTTP 400 with suggested alternatives (not charged)
- Invalid provider ID pattern returns 400
- Requesting more than 5 models in a comma list returns error
- Capability filter with no matching models returns empty results array
- Stale pricing if LiteLLM upstream has not been updated recently (as_of date indicates freshness)

## How this service works

Use when an agent must price an LLM call or pick the cheapest model. Input: model (up to 5, comma list) plus optional input_tokens, output_tokens, requests; or no model plus mode, provider, min_context, capabilities (vision, function_calling...). Output: JSON USD per 1M input/output tokens, cached/batch prices, context window, provider, capabilities, cost estimate or cheapest ranking, as_of + source commit. Example: ?model=gpt-4o&input_tokens=12000&output_tokens=800

## Output

A JSON object containing: the query echo, data freshness date and LiteLLM source commit, and per-model results with input/output/cached/batch prices per 1M tokens, context window size, capabilities list, deprecation status, and (if token counts or request count provided) a full cost breakdown including total_cost_usd and cost_per_request_usd. In ranking mode, returns models sorted by cost ascending.

## Request schema (JSON Schema)

```json
{
 "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"
     ],
     "type": "string"
    },
    "queryParams": {
     "type": "object",
     "required": [],
     "properties": {
      "mode": {
       "enum": [
        "chat",
        "embedding",
        "completion",
        "rerank",
        "image_generation",
        "audio_transcription",
        "audio_speech",
        "realtime",
        "moderation"
       ],
       "type": "string",
       "examples": [
        "chat"
       ],
       "description": "Model type for the cheapest search (default chat; chat includes responses-API models). Ignored when model is given"
      },
      "limit": {
       "type": "integer",
       "maximum": 25,
       "minimum": 1,
       "examples": [
        5
       ],
       "description": "Max rows per model or in the ranking (default 10)"
      },
      "model": {
       "type": "string",
       "examples": [
        "gpt-4o"
       ],
       "maxLength": 400,
       "description": "Model name(s), up to 5 comma-separated (gpt-4o, claude-sonnet-4-5, gemini/gemini-2.5-flash). Also lists the same model at other providers. Omit to rank the cheapest models. Unknown → 400 with suggestions (not charged)"
      },
      "provider": {
       "type": "string",
       "pattern": "^[A-Za-z0-9_.-]{1,40}$",
       "examples": [
        "openai"
       ],
       "description": "LiteLLM provider id filter: openai, anthropic, gemini, vertex_ai, bedrock, azure, groq, deepseek, mistral..."
      },
      "requests": {
       "type": "integer",
       "maximum": 1000000000,
       "minimum": 1,
       "examples": [
        1000
       ],
       "description": "Number of requests to multiply the estimate by (default 1)"
      },
      "min_context": {
       "type": "integer",
       "maximum": 100000000,
       "minimum": 1,
       "examples": [
        100000
       ],
       "description": "Minimum context window (max input tokens)"
      },
      "capabilities": {
       "type": "string",
       "examples": [
        "vision"
       ],
       "maxLength": 200,
       "description": "Comma-separated required capabilities: vision, function_calling, reasoning, prompt_caching, response_schema, pdf_input, audio
… (truncated)
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "kind": "lookup",
  "as_of": "2026-10-18",
  "query": {
   "mode": "chat",
   "limit": 3,
   "model": [
    "gpt-4o"
   ],
   "provider": null,
   "requests": 1000,
   "min_context": null,
   "capabilities": [],
   "input_tokens": 12000,
   "output_tokens": 800,
   "include_deprecated": false
  },
  "source": {
   "url": "https://github.com/BerriAI/litellm/blob/af194c842cd8c0276f69fc05efacaa18505c7484/model_prices_and_context_window.json",
   "name": "LiteLLM model_prices_and_context_window.json",
   "commit": "af194c842cd8c0276f69fc05efacaa18505c7484",
   "license": "MIT",
   "committed_at": "2026-10-18T02:54:27Z",
   "models_in_table": 3418
  },
  "results": [
   {
    "query": "gpt-4o",
    "listings": [
     {
      "mode": "chat",
      "model": "gpt-4o",
      "estimate": {
       "requests": 1000,
       "input_tokens": 12000,
       "output_tokens": 800,
       "input_cost_usd": 30,
       "total_cost_usd": 38,
       "output_cost_usd": 8,
       "cost_per_request_usd": 0.038,
       "long_context_tier_applied": false
      },
      "provider": "openai",
      "deprecated": false,
      "capabilities": [
       "vision"
      ],
      "context_window": 128000,
      "deprecation_date": null,
      "input_per_1m_usd": 2.5,
      "long_context_tier": null,
      "max_output_tokens": 16384,
      "output_per_1m_usd": 10,
      "batch_input_per_1m_usd": 1.25,
      "batch_output_per_1m_usd": 5,
      "cached_input_per_1m_usd": 1.25
     }
    ],
    "exact_match": true,
    "listings_total": 5
   }
  ],
  "attribution": "Prices: LiteLLM model_prices_and_context_window.json, MIT License, Copyright (c) 2023 Berri AI. List prices as compiled by LiteLLM; confirm with the provider b…"
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/llm-price-calculator-17d469cf/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from 1gateway.dev](https://www.zero.xyz/host/1gateway.dev/llms.txt)
