---
title: "Get LLM cost metrics"
method: POST
path: "/llm/cost"
tags: ["Llm"]
---

# Get LLM cost metrics

`POST /llm/cost`

## Request

- Base URL: `https://api.your-domain.com`
- URL: `https://api.your-domain.com/llm/cost`
- Auth: API key in header `X-API-KEY`
- TypeScript: <https://skmtc.dev/neulandai/apis/neuland-ai-hub-api/docs/llm/cost/post.ts> (a function with typed inputs; its response is checked against the schema)

Return current-month total LLM cost and per-model cost timeseries for the tenant.

## Query parameters

- `cookie_name` string, nullable
- `tenant_id` integer

## Request body

- UsageRequest: Generic usage request model for both token and cost queries.
  - `granularity` 'monthly' | 'yearly' | 'custom', required: Aggregation window; 'custom' requires date_start and date_end.
  - `date_start` string, date-time, nullable: Start of the custom range (used only when granularity is 'custom').
  - `date_end` string, date-time, nullable: End of the custom range (used only when granularity is 'custom').

## Response `200`

Successful Response

- TimeseriesResponse: Timeseries response model for LLM costs. Contains total cost for the current month and timeseries data for each model.
  - `total_cost` number, required: Total LLM cost for the current month across all models.
  - `timeseries` object, required: Cost timeseries keyed by model name.

## Other responses

- `401`: Missing or invalid authentication.
- `403`: Admin privileges required.
- `422`: Validation Error

---

[API](https://skmtc.dev/neulandai/apis/neuland-ai-hub-api.md) - [All operations](https://skmtc.dev/neulandai/apis/neuland-ai-hub-api/llms.txt) - [OpenAPI document](https://skmtc.dev/neulandai/apis/neuland-ai-hub-api/revisions/b53e89b98c2b?raw)
