Skip to main content
The LLM Gateway is in beta.
Direct model access exposes each provider API through a provider-specific gateway path. The gateway still handles authentication, provider secrets, policies, and tracing, but it does not translate the request and response into another provider’s API format. Direct model access is the path LangChain and Deep Agents use by default. For other clients, use it when you want a provider’s native request and response behavior. To call models across providers in one API format, use the standard endpoint instead.

Choose a provider path

Append a provider path to your regional gateway base URL, for example https://eu.gateway.smith.langchain.com/anthropic for direct Anthropic access in GCP EU: Each path uses the provider key stored in the caller’s workspace. For secret names, see Provider authentication. Gateway Credits models use the standard endpoint rather than a provider-specific path. These hosted models require no provider secret of your own.

Configure provider SDKs

Set each provider SDK’s base URL to its direct gateway path and use your LangSmith API key as the provider API key:
The gateway resolves the actual provider key provider secrets, so the provider key does not need to be stored locally.
Direct paths use the provider’s native model name without a provider prefix.

Create embeddings

The gateway routes embeddings requests to OpenAI, Azure Foundry, and Gemini Enterprise Agent Platform through their direct paths. Use these paths to generate vectors with the same workspace credentials, policies, and tracing as other gateway requests. The standard endpoint does not accept embeddings requests. Configure the provider’s workspace credentials before sending a request. Authenticate to the gateway with your LangSmith API key, not a provider key. The examples use the US Cloud hostname. To use another region, replace it with your regional gateway hostname.

Call OpenAI or Azure Foundry

For OpenAI, set model to the embedding model ID without an openai/ prefix. For Azure Foundry, use the deployment name on your configured Foundry resource, not the underlying model ID.
Both endpoints return the provider’s OpenAI-format embeddings response, with vectors in data[].embedding.

Call Gemini Enterprise Agent Platform

Gemini Enterprise Agent Platform uses Google’s native request and response formats. The short paths in the table use the project and location from your Gemini Enterprise Agent Platform credentials and workspace secrets. You can also specify them in the path: /vertex/v1/projects/{project}/locations/{location}/publishers/google/models/{model}:{action}. The gateway accepts the same path forms under v1beta and v1beta1.
Replace <project-id> in the :predict example with your Google Cloud project ID. Choose a location where the model is available. The :predict route only accepts model IDs beginning with gemini-embedding-. Other models, including text-embedding-*, text-multilingual-embedding-*, and multimodalembedding@001, return 501. Read vectors from embedding.values for embedContent, embeddings[].values for batchEmbedContents, and predictions[].embeddings.values for predict.

Use LangChain embeddings

Configure OpenAIEmbeddings explicitly with the direct gateway base URL and your LangSmith API key:
The LANGSMITH_GATEWAY setup for chat models in the next section is not a substitute for configuring an embeddings client’s base URL.

Track usage and apply policies

Embeddings requests pass through gateway policies and appear in gateway traces as LLM runs. Token usage comes from the provider response. Embeddings requests do not use fallback chains. If the model has no matching price entry, add a model price to track embedding costs.

Configure LangChain and Deep Agents

LangChain chat models and Deep Agents, including Deep Agents Code, reach these provider paths through the LANGSMITH_GATEWAY environment variable:
Deep Agents Code also requires LANGSMITH_GATEWAY_API_KEY. Set it to the same key:
LANGSMITH_GATEWAY support requires these minimum Python package versions: langchain-anthropic>=1.5.1, langchain-baseten>=0.2.3, langchain-fireworks>=1.5.1, langchain-google-genai>=4.3.2, and langchain-openai>=1.4.1.
Each supported integration appends its own provider path, so ChatAnthropic calls https://gateway.smith.langchain.com/anthropic and ChatOpenAI calls https://gateway.smith.langchain.com/openai/v1. To route requests through the standard endpoint instead, see Send your first LLM Gateway request.

See also