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

# AI Gateway traces

> Inspect every AI Gateway request as a detailed trace. View latency, token usage, cache hits, and provider responses for each routed call.

## What are Traces

**Traces** provide visibility into the workflow of each model generation and revealing the inner workings of an LLM call on **the AI Gateway**.

Traces correspond to events within the generations, following each call to the model configured in the **AI Gateway**.

### Use Cases

* **Monitor Performance**: Identify bottlenecks by checking which operations take the most time. Optimize prompts or model selections accordingly.
* **Track Costs**: See exactly which operations are consuming tokens and costing money. Understand the cost breakdown across different models and operations.
* **Debug Issues**: When something goes wrong, traces show exactly where in the request pipeline the failure occurred, helping identify root causes.
* **Optimize Routing**: For AI applications using model routing, traces show which models were selected and how the routing logic performed.
* **Analyze Request Flow**: Understand how requests are processed by seeing the complete operation hierarchy and dependencies.

## Viewing Traces

To view Traces, go to **Traces** in the **AI Gateway** sidebar.

<Frame caption="Traces view in the AI Gateway.">
  <img src="https://mintcdn.com/orqai/1k0I099Or1jlaZgO/images/ai-gateway-traces.png?fit=max&auto=format&n=1k0I099Or1jlaZgO&q=85&s=1b2f8f75dc0d8b3953143ca99ef40048" alt="Traces table showing request rows with model, status, latency, and cost columns." width="1632" height="895" data-path="images/ai-gateway-traces.png" />
</Frame>

The following details are available to visualize:

* **Request Timeline**: A hierarchical breakdown of all operations that occurred during the request, from routing decisions to model invocations.
* **Operation Details**: Each step in the trace shows:
  * Model used and provider information.
  * Token consumption (input/output).
  * Cost for that specific operation.
  * Status and any error information.
* **Request Metadata**:
  * Unique trace ID for tracking.
  * Total request duration.
  * Aggregated token usage and cost.

## Filtering Traces

You can filter traces to find specific requests or focus on particular aspects of AI Gateway calls:

| Filter                | Description                                                     |
| --------------------- | --------------------------------------------------------------- |
| **Model**             | Filter by specific models used (e.g., gpt-5, claude-sonnet-4-6) |
| **Provider**          | Filter by provider (e.g., OpenAI, Anthropic, Google)            |
| **Status**            | Filter by request status (Success, Error, etc.)                 |
| **Cost Range**        | Filter traces by cost (minimum and maximum values)              |
| **Duration**          | Filter by request execution duration                            |
| **Date Range**        | Filter traces by when they were created                         |
| **Custom Attributes** | Filter by metadata or custom attributes attached to requests    |

To apply filters, use the <kbd><Icon icon="bars-filter" /></kbd> **button**. Combine multiple filters to narrow down your results.

## Managing Columns

Show and hide columns to display the most relevant data.

**To customize columns:**

* Look for the <kbd><Icon icon="columns" /></kbd> **button** in the traces table header
* Toggle columns on or off to show/hide specific data such as:
  * Model, Provider, Status
  * Token usage (input/output)
  * Cost, Duration, Latency
  * Trace ID, Timestamp
  * Custom metadata fields

## Creating Custom Views

Save frequently used filter combinations as reusable views that can be shared across the team.

**To create a custom view:**

1. **Set the desired filters** - Apply the desired filters (e.g., filter by model, status, date range)
2. Click <kbd><Icon icon="eye" /> All Rows</kbd> (top right)
3. Select <kbd><Icon icon="plus" /> Create New View</kbd>
4. **Give the view a title** - Enter a descriptive name (e.g., "GPT-4o Errors", "High-Cost Requests")
5. Choose **Make this view private** to keep this view personal (not shared with team members).
6. **Save** - Your filtered view is now created and accessible

Click <kbd><Icon icon="eye" /> All Rows</kbd> at the top right to see all available views. Select any saved view to instantly apply those filters and see the relevant traces.

## Reference

<Card title="Span Attributes" icon="tag" href="/docs/ai-gateway/orq-attributes">
  Complete reference for all `orq.*` span attributes in **AI Gateway** traces, webhook payloads, and trace exports.
</Card>
