---
title: "LLM Cost Calculate (x402)"
method: GET
path: "/x402/v2/llm-cost-calculate"
tags: ["x402"]
---

# LLM Cost Calculate (x402)

`GET /x402/v2/llm-cost-calculate`

## Request

- Base URL: `https://api.strale.io`
- URL: `https://api.strale.io/x402/v2/llm-cost-calculate`
- Auth: none required

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

## Query parameters

- `model` string, required
- `prompt_text` string
- `prompt_tokens` integer
- `completion_text` string
- `completion_tokens` integer

## Response `200`

Success

- object
  - `cost_usd` number
  - `input_tokens` integer
  - `output_tokens` integer
  - `cheaper_alternatives` unknown[]
    - unknown

## Other responses

- `402`: Payment required (x402 — pay with USDC on Base)

---

[API](https://skmtc.dev/strale/apis/strale-api-2.md) · [All operations](https://skmtc.dev/strale/apis/strale-api-2/llms.txt) · [OpenAPI document](https://skmtc.dev/strale/apis/strale-api-2/revisions/a5293878cfc6?raw)
