# LLM API Cost Calculator

> LLM API Cost Calculator is a paid API for AI agents from api.strale.io, paid per call via x402, $0.0216/call, status unknown (last checked 2026-10-12).

Calculates the API cost for a given LLM prompt and completion across 14 models, returning cheaper alternatives with savings percentages.

## Facts

- Endpoint: GET https://api.strale.io/x402/llm-cost-calculate?utm_source=zero.xyz
- Price: $0.0216/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-12
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/api-strale-io-1bf6eb4a
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_L6fYe6yfUYW8odRW9zFSb

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 api-strale-io-1bf6eb4a
```

Example prompt: 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?

## When to prefer this

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.

## Known failure modes

- 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

## How this service works

Calculate LLM API cost for a prompt+completion across 14 models. Returns cheaper alternatives with savings percentages. Algorithmic.

## Output

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.

## Example request

```json
{
 "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
}
```

## 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",
      "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
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/api-strale-io-1bf6eb4a/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from api.strale.io](https://www.zero.xyz/host/api.strale.io/llms.txt)
