List spend summaries
import requests
url = "https://app.langwatch.ai/api/gateway/v1/spend-summaries"
headers = {"X-Auth-Token": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-Auth-Token': '<api-key>'}};
fetch('https://app.langwatch.ai/api/gateway/v1/spend-summaries', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request GET \
--url https://app.langwatch.ai/api/gateway/v1/spend-summaries \
--header 'X-Auth-Token: <api-key>'{
"data": [
{
"key": "<string>",
"event_count": 123,
"settled_count": 123,
"usage": {
"input_tokens": 123,
"output_tokens": 123,
"cache_read_input_tokens": 123,
"cache_creation_input_tokens": 123,
"reasoning_tokens": 123
},
"cost": {
"total_usd": "<string>",
"nano_usd": 123
}
}
],
"next_cursor": "<string>"
}{
"error": {
"type": "<string>",
"code": "<string>",
"message": "<string>",
"meta": {},
"trace_id": "<string>",
"span_id": "<string>"
}
}{
"error": {
"type": "<string>",
"code": "<string>",
"message": "<string>",
"meta": {},
"trace_id": "<string>",
"span_id": "<string>"
}
}{
"error": {
"type": "<string>",
"code": "<string>",
"message": "<string>",
"meta": {},
"trace_id": "<string>",
"span_id": "<string>"
}
}{
"error": {
"type": "<string>",
"code": "<string>",
"message": "<string>",
"meta": {},
"trace_id": "<string>",
"span_id": "<string>"
}
}Gateway: Spend
List spend summaries
Reconciliation checksum fast path: per-key spend rollups grouped by virtual key or end user, with token classes and integer nano-USD cost. Settled (unpriced) requests are counted separately as settled_count and never included in cost sums. Diff individual items via /spend-events only when a checksum diverges. Paged by group key ascending: follow next_cursor until it comes back null, because a page that is full does not mean the window held nothing more.
GET
/
api
/
gateway
/
v1
/
spend-summaries
List spend summaries
import requests
url = "https://app.langwatch.ai/api/gateway/v1/spend-summaries"
headers = {"X-Auth-Token": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-Auth-Token': '<api-key>'}};
fetch('https://app.langwatch.ai/api/gateway/v1/spend-summaries', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request GET \
--url https://app.langwatch.ai/api/gateway/v1/spend-summaries \
--header 'X-Auth-Token: <api-key>'{
"data": [
{
"key": "<string>",
"event_count": 123,
"settled_count": 123,
"usage": {
"input_tokens": 123,
"output_tokens": 123,
"cache_read_input_tokens": 123,
"cache_creation_input_tokens": 123,
"reasoning_tokens": 123
},
"cost": {
"total_usd": "<string>",
"nano_usd": 123
}
}
],
"next_cursor": "<string>"
}{
"error": {
"type": "<string>",
"code": "<string>",
"message": "<string>",
"meta": {},
"trace_id": "<string>",
"span_id": "<string>"
}
}{
"error": {
"type": "<string>",
"code": "<string>",
"message": "<string>",
"meta": {},
"trace_id": "<string>",
"span_id": "<string>"
}
}{
"error": {
"type": "<string>",
"code": "<string>",
"message": "<string>",
"meta": {},
"trace_id": "<string>",
"span_id": "<string>"
}
}{
"error": {
"type": "<string>",
"code": "<string>",
"message": "<string>",
"meta": {},
"trace_id": "<string>",
"span_id": "<string>"
}
}Authorizations
Project API key for sending traces and accessing project-scoped resources. Format: sk-lw-... (no underscore). Obtain one by creating a project via the Admin API or the LangWatch UI.
Query Parameters
Available options:
virtual_key, end_user Required string length:
1 - 100Maximum string length:
500Required range:
x <= 1000Required string length:
1 - 100Was this page helpful?
⌘I