> ## Documentation Index
> Fetch the complete documentation index at: https://developers.telnyx.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Spend Logs

> The requests an Agent Gateway served with its keys, with their tokens and cost.

[`GET /v2/agent_gateways/{id}/spend_logs`](https://developers.telnyx.com/api-reference/agent-gateway-spend-logs/list-spend-logs) lists the requests an instance served with its [keys](https://developers.telnyx.com/docs/agent-gateway/authentication/keys.md), newest first. A row appears a few seconds after its request. Rows cover model requests, MCP tool requests, and refused requests, and leave out successful `GET {gateway_url}/v1/models` requests.

## Window and Filters

| Parameter | What It Does |
| - | - |
| `start`, `end` | The window, as RFC 3339 timestamps with an offset. It defaults to the 24 hours before now, and spans at most 31 days. |
| `key_id` | Only the requests made with this key. |
| `team_id` | Only the requests made with this team's keys. |
| `page[number]`, `page[size]` | The page, counting from 1, and its size, 1 to 100 and 50 by default. |

```bash Host theme={null}
curl -G "https://api.telnyx.com/v2/agent_gateways/32ce035d-3165-4031-b1a7-a7c0c259590a/spend_logs" \
  -H "Authorization: Bearer $TELNYX_API_KEY" \
  --data-urlencode "start=2026-10-26T00:00:00Z" \
  --data-urlencode "team_id=d7b21324-a2bf-406c-ba49-c6ec4d23d476"
```

## Rows

Each row is one request. Prompts, responses, and request metadata are not shown.

```json Output theme={null}
{
  "data": [
    {
      "id": "chatcmpl-653db9ce-f80c-4497-8f33-610bcf4fde35",
      "key_id": "f739ad190d29e2a5e658c3a486111953e6c18d746fd04374962ab150aae17757",
      "team_id": "d7b21324-a2bf-406c-ba49-c6ec4d23d476",
      "model": "zai-org/GLM-5.3-Flash",
      "operation": "acompletion",
      "status": "success",
      "spend": 0,
      "prompt_tokens": 14,
      "completion_tokens": 200,
      "total_tokens": 214,
      "started_at": "2026-10-26T16:07:12.105000Z",
      "ended_at": "2026-10-26T16:07:14.042000Z",
      "duration_ms": 1937
    },
    ...
  ],
  "meta": {
    "total_results": 12,
    "page_number": 1,
    "page_size": 50,
    "total_pages": 1,
    "total_results_capped": false
  }
}
```

`model` is the Telnyx Inference model that answered. `spend` is the request's cost in USD, with its tokens at [Telnyx Inference prices](https://developers.telnyx.com/docs/inference/models/pricing.md). Spend prices at list on instances created since 2026-10-29; instances created before that date record every request's spend as `0` (AIPLAT-1630), as this row does. For an MCP tool request, `model` is `MCP: ` and the tool's name. `operation` is the request type, such as `acompletion` for a chat completion or `call_mcp_tool` for a tool request. `status` is `success` or `failure`.

A window counts at most 10,000 rows. When it holds more, `total_results_capped` is `true`, and `total_results` and `total_pages` are lower bounds. Narrow the window, or page until a page comes back empty.
