The LLM Gateway is in beta.
Open the dashboard
To view gateway spend:- In the LangSmith UI, select LLM Gateway in the left navigation.
- Select Usage.
- Select the workspace you want to analyze.
Set the time range and granularity
Use the time controls 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.
- Granularity: Group spend into hourly, daily, or weekly buckets. The available options depend on the length of the selected time range.
- Previous or next period: Shift backward or forward by one period of the same length to compare adjacent time ranges.
Break down and filter spend
Select Breakdown by to group spend across one of these dimensions:- 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.
Interpret the spend summary
The summary cards describe spend 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 user, API key, or model for each time bucket. When you have not applied an entity filter, this metric uses the top 10 entities by spend.
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. When no filter is applied, the chart displays the six highest-spend entities as individual series and combines the remaining entities into Other. 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.
Drill into a user or API key
Select a user or API key row to open a detailed view:- From a user, view spend grouped by API key.
- From an API key, view spend grouped by user.
Group spend by custom header
Custom-header grouping breaks down an API key’s spend by request header value. Use it to compare spend across your end customers or teams under one API key. This option requires an enabled default API-key spend policy with Separate limits by custom header configured. An organization-level policy with a Custom header condition does not enable this option. Neither does a default workspace or user policy. To configure custom-header grouping:- Go to LLM Gateway > Cost Controls and click Create spend limit, or edit an existing default API-key spend policy.
- Select API Key, then select the option to apply the limit to every API key by default.
- Select Separate limits by custom header.
- Enter the Header name without the
X-Gateway-prefix. For example, enterCustomer-Idfor theX-Gateway-Customer-Idrequest header. Do not enter a header value: each request supplies its own value. - Set the spend limit and period, save the policy, and ensure it is enabled.
- Send the full
X-Gateway-Customer-Idheader on gateway requests from your backend. For request examples, see Send a customer header on every call. - Return to Usage, refresh the page, and select API Key from Breakdown by.
- Select an API-key row. In the detailed view, select Custom header from Group by.
See also
Connect these docs to your agent of choice via MCP for real-time answers.

