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

# Usage and logs

> What your organization spent on model calls, by person, group, key, model, client, provider, agent and license, and the record of every request in Logs.

Every model call through the LLM Gateway is one request with one record: who made it, what started it, which client, model and provider, tokens in and out, cost, and how long it took. Two pages under **Platform > AI governance** read those records: [Usage](https://platform.xpander.ai/governance/usage) for spend, [Logs](https://platform.xpander.ai/governance/logs) for the requests themselves.

## Usage

<Frame caption="Usage grouped by person over the last 7 days. Shown with sample data.">
  <img src="https://mintcdn.com/xpanderai-099931d1/65C_XNxucwf3Ltb_/images/llm-gateway/11-usage.png?fit=max&auto=format&n=65C_XNxucwf3Ltb_&q=85&s=7aaeda2821845d344c9286048920495e" alt="Usage page with total cost, requests and tokens, a daily cost chart by person and a table by person" width="1662" height="1067" data-path="images/llm-gateway/11-usage.png" />
</Frame>

[Usage](https://platform.xpander.ai/governance/usage) shows what the organization spent in the range you pick (**Last 24 hours**, **Last 7 days**, **Last 30 days**, **This month** or **Custom range**).

* The top row shows **Total cost**, with the change against the previous period, and one tile per payer: **Subscription: xpander credits** for calls on keys included with xpander, **Subscription: your provider keys** for calls on your own keys, and **Subscription: personal Claude and ChatGPT plans** for calls on people's own plans. When your organization uses only one kind of provider credential, the provider keys tile reads **Subscription: API key** or **Subscription: IAM assume role**. **Requests** and **Tokens in / out** follow.
* **Group by** splits the chart and the table by **Person**, **Group**, **API key**, **Model**, **Client**, **Provider**, **Account**, **Agent** or **License model**. **Hourly** and **Daily** set the chart's step for ranges up to 7 days.
* **+ Filter** narrows everything to the same dimensions. In the table, a row's menu offers a filter for that row, such as **Filter by this person**, and **View requests**, which opens Logs with the same filters.
* **Export > Download cost by ... (CSV)** downloads the table.

Costs are estimated from token counts and xpander's model prices, including cache reads and writes. For calls on your own key, your provider's invoice is exact.

## Logs

<img src="https://mintcdn.com/xpanderai-099931d1/65C_XNxucwf3Ltb_/images/llm-gateway/12-logs.png?fit=max&auto=format&n=65C_XNxucwf3Ltb_&q=85&s=8336ac0ff13ae8e5c4e6ad54b66272c8" alt="Logs page with tokens and cost over time and the calls table, one row per conversation or call" width="1940" height="1203" data-path="images/llm-gateway/12-logs.png" />

[Logs](https://platform.xpander.ai/governance/logs) lists requests newest first. Requests that belong together, such as the calls of one agent run or one coding session, are grouped into a trace with totals for the whole trace.

| Column | What it shows |
| - | - |
| **Time** | When the call started |
| **Calls** | For a trace, how many model calls it holds |
| **Person** | Who made the call, or `-` when no one did (below) |
| **Source** | What started it: a chat, a schedule, a coding tool, an API key, or the step of work xpander did for you (below) |
| **Agent** | The agent that made the call |
| **Model** | The model, with a tag for how the call reached the gateway |
| **Tokens in / out** | Input and output tokens |
| **Cost** | Estimated cost, or **Not billed** |
| **Duration** | Total time; a call refused before the provider shows `-` |
| **Status** | Succeeded, failed, or the reason it was refused, such as **Budget reached**, **Model not allowed** or **No credential** |

**Live** shows new requests as they arrive, and **Pause** stops the updates. The range menu and the refresh button sit beside it.

### Filters

**+ Filter** narrows the list. Every filter you set is kept in the page address, so a filtered view can be shared as a link, and **Clear filters** removes them all.

| Filter | Narrows to |
| - | - |
| **Person**, **Group** | Requests made by a person, or by members of a group |
| **Model**, **Client**, **API key**, **Agent** | Requests on that model, from that client (such as Claude Code or the OpenAI SDK), with that key, or by that agent |
| **Status** | **Succeeded**, **Failed** or **Plan limit** (a person's own plan could not serve the call) |
| **Started by** | What started the agent run: **Chat**, **Schedule**, **API**, **Webhook**, **Workflow**, **Another agent**, **Slack**, **MCP**, **A2A**, **Email**, **WhatsApp**, **Telegram**, **Microsoft Teams** or **Other** |
| **License model** | **Bring your own subscription**, **Bring your own key** or **Included with xpander** ([Licenses](/run/llm-gateway/which-key-pays)); shown when your organization uses more than one |
| **xpander operation** | With **System calls** chosen, work xpander did for your organization: **Connector generator**, **Conversation summaries**, **Agent builder and evaluations**, **Custom function checks**, **Built-in tools** or **Bots** |

Type a request or trace ID in the search box (**Request or trace ID**) and press Enter to open it. A request opens at `https://platform.xpander.ai/governance/logs/<request or trace ID>`, so you can share it as a link.

### Export

**Export** downloads what the filters show: **Download CSV**, **Download JSON**, or **Copy as table** to paste into a spreadsheet. Each row carries the time, request and trace IDs, status, person, group, agent, operation, conversation, key, model, client, license model, tokens, cost, whether it was billed, latency and the error. Exports never include prompt or response text.

### A trace or a request

<img src="https://mintcdn.com/xpanderai-099931d1/65C_XNxucwf3Ltb_/images/llm-gateway/13-request-detail.png?fit=max&auto=format&n=65C_XNxucwf3Ltb_&q=85&s=ef7acd7c1d892bf6aa01a027cff755ba" alt="Trace of one chat conversation with each turn's message, calls, time, credits and the answer" width="1156" height="820" data-path="images/llm-gateway/13-request-detail.png" />

Opening a trace shows its steps, with each turn's **User message** and **Result**. A trace that is still running shows **Live** and refreshes on its own; the pause button stops the refresh and the play button starts it again.

Opening a request shows:

| Section | What it holds |
| - | - |
| Summary | **Model**, **Latency**, **Tokens** and **Estimated cost** |
| Who | **Person**, **Group**, **Agent**, **Operation**, **API key**, **License model**, **Started by**, **Client**, **Conversation** (with a link to all its requests) and **User agent** |
| **Routing** | **Requested model**, the **Alias** it matched and what it **Resolves to**, **Fallbacks**, and each of the **Attempts** |
| **Gateway decisions** | Every check the call met (**Own plan**, **Credits**, **Budget**, **Limits**, **Request rate**, **Token rate**, **Parallel calls**) and its verdict: **Allowed**, **Blocked**, **Paused**, **Fell back**, **Warning** or **Skipped** |
| **Prompt and response** | When text is saved (below): the conversation, the raw request and answer as JSON, and a copy button |

Hovering a cost shows who paid it, such as **Subscription: xpander credits**, **Subscription: API key** with the key's name, or the person's Claude plan.

### Prompt and response text

Usage, cost and timing are always kept. Prompt and response text is kept for everyone unless an admin turns off [Saved prompt text](/run/llm-gateway/policies#prompt-and-response-text) for it. A request without saved text says so on its row. Anyone whose role may view usage can open saved text, and every opened request is recorded in the [Audit log](https://platform.xpander.ai/governance/audit). Exports and [log destinations](/run/llm-gateway/logs-export) never include the text.

## Requests xpander makes for you

Some features call a model on your organization's behalf: conversation titles and summaries, building an API connector from its spec, generating an agent's details, checking custom function code, image generation and transcription in built-in skills, and bot replies. These requests appear in Logs like any other, so you can see every model call made for your organization.

* The **Person** column shows the person who started the work, such as an admin creating an API connector, or `-` when no one did.
* The **Source** column names the operation's step, such as **Tags step**. Hover it for the operation, such as **Connector generator**, what it does and who started it.
* The cost reads **Not billed** when the request ran on xpander's own key; hover it for the cost xpander measured. These requests use no credits and count toward no budget.
* When the request ran on your own provider key, which is always the case on a self-hosted install, your provider bills it, so the row shows its cost.
* A few operations are charged in credits, such as scoring an agent's answers in evaluations. Their rows show the cost like any other request.

Choose **System calls** above the table to list only these requests, and the **xpander operation** filter to narrow them to one operation. **Calls** returns to everyone's own requests.

## How long requests are kept

**Keep requests for** in [Policies](https://platform.xpander.ai/governance/policies) sets the retention ([Retention](/run/llm-gateway/policies#retention)). A request older than that opens as **No request or trace with this ID**.

Requests are stored in your organization's own database: on xpander cloud a database dedicated to your organization, on a self-hosted install the PostgreSQL database of your install.

## Hybrid installs

On a Hybrid install, requests from agents that run on your install are stored inside your environment. When your browser cannot reach your environment directly, Logs shows **Needs a direct connection to your environment**. Usage totals for billing always show, and the calls people's coding tools make through xpander cloud show in Logs as usual.

## Your own spend

Each person sees their own spend for the day, week or month, with their spending limit when one applies, in [Usage](https://chat.xpander.ai/?settings=my-usage) in Xpander Chat (**Settings > Usage**). At the limit it shows **Limit reached** and when calls resume.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.