The LLM Gateway is in beta.
Where gateway traces appear
Every gateway-proxied call is traced to a project namedgateway in the workspace associated with the caller’s API key. To control who can see these traces, see Restrict trace visibility.
Open the Traces tab
To view gateway requests, go to LLM Gateway and select the Traces tab. The Simulator’s View trace button opens its request in this tab, and the View traces button in a Usage detailed view opens the traces behind one user’s, API key’s, or header value’s spend. On the Developer plan, open thegateway tracing project in your workspace instead.
Trace content (request and response bodies) is off by default for all organizations, so gateway traces record only metadata, such as token counts, policy outcomes, and caller identity. Traces without content are not billed against your LangSmith trace quota. To store content, turn on Trace content in a data policy. Traces that match a content-logging data policy count toward your plan’s trace volume.
Trace metadata
Gateway-proxied calls are distinguishable from direct LLM calls by the project they land in and the metadata attached to their spans. Gateway-specific keys appear undergateway. in the trace metadata, recorded as langsmith.metadata.gateway.* span attributes:
- Gateway project: Filter by the
gatewayproject, or by the presence oflangsmith.metadata.gateway.*span attributes, to find gateway-proxied calls. - Caller identity:
gateway.workspace_id,gateway.api_key_id, andgateway.user_agent, the calling client’sUser-Agentheader.gateway.user_idis set only for personal access tokens, so service-key calls have no user. - Credential source:
gateway.credential_sourcenames the credential that paid for the provider call:byokfor the workspace’s provider key,creditsfor Gateway Credits,subscription_oauthfor a Claude subscription, orplatform_managed. Every gateway trace carries this key. - Authentication mode:
gateway.auth_modeis set only when the caller did not authenticate with a LangSmith API key, such asclaude_max_oauthfor a Claude subscription. - Model and provider:
ls_model_nameandls_provider, which the Usage tab groups spend by. - Request headers: each
X-Gateway-*request header, recorded asgateway.<name>. For how names are normalized, see Matchable headers. - Policy evaluation results: Every gateway span records which policies were evaluated and their outcome via
langsmith.metadata.gateway.policy.matched_ids/_names,passed_ids/_names, andviolated_ids/_names, so both passes and blocks are captured. - Guard rule matches: When redaction policies apply, the guard pipeline emits a
rule_id → countmap stamped onto the span aspolicy.matched_rules,passed_rules, andviolated_rules. These are rule IDs, not PII or secret category labels. - Content flags:
ls_metadata_onlyistrueon a trace stored without request and response content.content_quota_exceededis alsotruewhen the gateway dropped the content because a monthly trace limit was reached. - Cost data: Token counts and cost are computed inline and feed the same spend accumulator that spend-cap policies enforce against.
Restrict trace visibility
Gateway traces are written as runs into a workspace project and follow LangSmith’s standard workspace membership model. Anyone withruns:read (and projects:read to see the project itself) on the workspace can view traces in that workspace’s gateway project. The built-in Workspace Admin, Workspace Editor, and Workspace Viewer roles all include both permissions by default.
If you need to limit who can see gateway traces, you have two options:
- Separate workspaces (works on any plan): create one workspace with restricted membership and another for developer coding agents with broader membership. Each workspace has its own provider secrets and trace projects.
- Project-level access policies (requires an Enterprise plan): write an ABAC policy restricting
projects:readandruns:readon the gateway project to specific users or roles.
LangSmith Engine integration
When a governance policy fires (such as when a spend limit is hit, PII is detected and redacted, or a secret is caught), the event is recorded as metadata on the trace. These policy violations surface as issues in LangSmith Engine. From an Engine issue, you can:- See the violation: which policy fired, what was blocked or redacted.
- Click through to the trace: see exactly what the agent was doing when the policy triggered.
- Diagnose the root cause: was it a retry loop burning budget, a user pasting credentials into a prompt, or a legitimate workload that outgrew its cap, etc.
- Take action: update the agent’s configuration, adjust the policy, or escalate.
Next steps
- Monitor LLM Gateway spend: track spend by user, API key, model, and provider.
- Spend policies: attach cost limits to API keys and users.
- Data policies: configure data policies.
Connect these docs to your agent of choice via MCP for real-time answers.

