The LLM Gateway is in beta.
- Usage: See how much LLM cost a workspace has accrued through the gateway, and drill down into the users, keys, models, and other dimensions behind it.
- Monitoring: View and edit a dashboard of charts on gateway metrics like request volume, latency, error rate, cost, and tokens.
runs:read-stats and projects:read permissions in the workspace, and a Plus or Enterprise plan. The Monitoring tab also requires charts:read.
Track LLM spend
The Usage tab shows how much LLM cost a workspace has accrued through the gateway. Use it to:- Compare spend over time.
- Identify the user groups, users, API keys, models, providers, and request header values that account for that spend.
- Attribute that spend for chargebacks.
Group and filter LLM spend
Within the Usage tab, select Breakdown by to group spend by one of the following dimensions:- User Group: Attributes spend to the user groups of the user associated with the personal access token that invoked the gateway. A user in several groups counts toward each of them, so user group totals can add up to more than total spend.
- User: Attributes spend to the user associated with the personal access token that invoked the gateway. Requests made with a workspace or organization-scoped service key appear as Unaffiliated with any user.
- API key: Attributes spend to the LangSmith API key that invoked the gateway.
- Model: Attributes spend to the model used for the request.
- Model Provider: Attributes spend to the provider that served the request, such as OpenAI or Anthropic.
- Custom Dimension: Attributes spend to the value of an
X-Gateway-*request header that your application sends.
X-Gateway-Service, and the X-Gateway- prefix is optional. Requests without the header appear under No value. For how to send these headers, see Header-based policies.
After you select a dimension, use the adjacent filter to show only the entities you select.
Set the time range and granularity
Use the controls to the chart’s top right to define the period covered by every summary, chart, and table on the page:- Time range: Select a preset range from one day to one year, or choose custom dates. Dates and time buckets use UTC.
- Aggregation granularity: Group spend into hourly, daily, or weekly buckets. The available options depend on the length of the selected time range.
Interpret the spend summary
The cards above the chart summarize spend and tokens for the selected workspace, time range, dimension, and filters:- Total Spend: The sum of gateway spend over the selected time range.
- Hourly, Daily, or Weekly Avg: Total spend divided by the number of time buckets in the selected range.
- Hourly, Daily, or Weekly Avg / dimension: Average spend per selected entity for each time bucket. When you have not applied an entity filter, this metric uses the top 10 entities by spend.
- Total Tokens: The number of tokens in requests routed through the gateway over the selected time range.
Analyze the chart and table
The stacked bar chart shows how each entity contributed to spend in every time bucket. Hover over a bar to view the bucket total and the contribution from each visible entity. The table summarizes the same selection with one row per visible entity. Use it to compare:- Hourly, Daily, or Weekly Avg: The entity’s total spend divided by the number of time buckets.
- Spend Share: The percentage of spend attributed to the entity.
- Total Spend: The entity’s total spend over the selected time range.
Attribute spend for chargebacks
A chargeback bills LLM costs back to the customer, tenant, or cost center that incurred them. Because every request routes through the gateway, the Usage tab can split spend along the same lines you bill against. Choose the dimension that matches who you charge:- Cost Centers, such as departments, internal groups, or products: Give each group its own service key, then break down by API key. Alternatively, have each group’s applications send a header such as
X-Gateway-Cost-Center, then break down by Custom Dimension. If your cost centers match your user groups and each user belongs to only one group, break down by User Group. - End customers of your application: Have your backend send a header such as
X-Gateway-Customer-Idon each request it makes for a customer, then break down by Custom Dimension. To also cap each customer’s spend, see Cap spend per end customer. - Individual users: Have each user call the gateway with their own personal access token, then break down by User.
- Custom dimensions: To bill against any other attribute, such as environment, have your applications send its value in an
X-Gateway-*header, then break down by Custom Dimension.
Visualize gateway metrics
The Monitoring tab in the LLM Gateway is a custom dashboard built on the workspace’sgateway tracing project, where the gateway traces every request. Use it to watch request volume, latency, errors, cost, and token usage across all gateway traffic, and to add charts for the metrics your team tracks.
The workspace has one gateway dashboard, which LangSmith creates the first time a user with the charts:create permission opens the tab. Until then, other users see Gateway monitoring isn’t set up yet. The dashboard starts with charts from the same sections as a prebuilt dashboard:
- Traces: Trace count, latency, and error rate.
- LLM Calls: LLM call count and latency.
- Cost & Tokens: Total cost, cost per trace, and input and output tokens.
charts:create permission:
- In the LLM Gateway, select the Monitoring tab.
- Click + Chart to open the chart creation pane, or drag Chart to the position you want on the dashboard.
- Configure the chart’s metric, filters, grouping, and visualization. Charts on this dashboard read from the
gatewayproject. For each option, see Chart configuration. - Click Create.
See also
- Spend policies: cap spend for organizations, workspaces, users, and API keys.
- Header-based policies: send the request headers that Custom Dimension groups by, and limit spend per header value.
- View LLM Gateway traces: inspect the individual requests behind the spend and charts.
- Monitor agents with dashboards: build and configure custom dashboards.
- View usage: view LangSmith trace usage and billing, which is separate from LLM Gateway spend.
Connect these docs to your agent of choice via MCP for real-time answers.

