Skip to main content
The standard LLM Gateway API supports three request and response formats. Choose the format your application already uses, then call bring-your-own-key or Gateway Credits models through the same endpoint.
Beta: The LLM Gateway is in beta.

Compare API formats

All formats authenticate with a workspace-scoped LangSmith API key. Pass it as the provider API key or as an Authorization: Bearer token. For bring-your-own-key models, set model to <provider>/<model>, such as openai/gpt-5.4-mini or anthropic/claude-sonnet-4-6. For Gateway Credits models, pass a supported model name, such as moonshotai/kimi-k3.

Use Chat Completions

Point an OpenAI-compatible client at https://gateway.smith.langchain.com/v1. For the full request and response schema, see the OpenAI Chat Completions API.

Use Messages

Point an Anthropic client at https://gateway.smith.langchain.com. For the full request and response schema, see the Anthropic Messages API.

Use Responses

Point an OpenAI-compatible client at https://gateway.smith.langchain.com/v1. For the full request and response schema, see the OpenAI Responses API.

Enable prompt caching

OpenAI models (Chat Completions and Responses) support implicit prompt caching automatically, no extra parameters are required. Anthropic models and some older OpenAI models require explicit opt-in to prompt caching. Pass provider-specific fields in your request body when calling these models through any standard gateway endpoint.
Explicit caching support is a temporary measure while a gateway-level caching policy is being developed. The following fields are passed through to the upstream provider.

Anthropic models

Include prompt_cache_options with a ttl value:
The same field works with the Chat Completions endpoint:
cURL

Older OpenAI models

Some older OpenAI models support explicit cache control via prompt_cache_retention. Set it to "in_memory" for most models. For gpt-5.5 specifically, use "24h":
cURL (most older models)
cURL (gpt-5.5 specifically)
For full prompt_cache_retention documentation, see the OpenAI prompt caching guide.

Understand translation behavior

The endpoint determines the format your application sends and receives. The model ID determines the upstream provider.
  • When the provider supports the selected format natively, the gateway preserves that format.
  • Otherwise, the gateway translates the request into a format supported by the provider and translates the response back, including streaming responses.
  • Translation can reject fields that cannot be represented in the target provider format. Use Direct model access when provider-native behavior is required.
Every request resolves the same Provider Secrets, policies, and tracing configuration regardless of format.

List models

Call GET /v1/models to list models available from providers configured for the workspace and from Gateway Credits. The gateway returns a single OpenAI-compatible list:
Bring-your-own-key model IDs use the form <provider>/<model>. Hosted models use the slug shown in the response. Pass either ID exactly as shown when making a call. A bring-your-own-key provider without a configured secret is omitted; hosted models do not require a provider secret.

Use a regional gateway

Replace gateway.smith.langchain.com with the hostname for your LangSmith region: Keep the same path for the selected API format.

Use a BYOC data plane

The LLM Gateway is also available on BYOC, where it runs inside your data plane so model requests and their traces stay in your VPC. Replace the gateway hostname with your data plane endpoint and prefix the path with /gateway: Authenticate with an API key scoped to a workspace in that data plane. Pass it as an Authorization: Bearer token:
Or pass it as the provider API key. For example, an Anthropic Messages request sends the key in the X-Api-Key header:
Provider secrets, model IDs, policies, and tracing behave the same as on Cloud.
Data planes are provisioned with a private endpoint by default, so you need private connectivity to reach the base URL, such as Tailscale, AWS PrivateLink, or VPC peering.

Handle errors

For setup-specific resolutions, see the Quickstart.

See also