LangChain
Wire LangChain's ChatOpenAI to the gateway as a custom baseURL.
Integrations
LangChain's ChatOpenAI accepts a configuration.baseURL option. Wire the gateway in once
and reuse the chain everywhere.
Config
ts
Use it in a chain
Streaming
LangChain's standard streaming API forwards through to the gateway's SSE response:
Tools
ChatOpenAI.bindTools() works as long as the underlying model has
capabilities.tools = true on the catalog page. The gateway translates tool definitions
to the upstream format and reverses for the response.
Troubleshooting
Invalid request to OpenAIin LangChain logs — LangChain wraps the gateway's 400 with its own message. Read the embeddederror.code(e.g.upstream_bad_request) for the real reason.OpenAIChat is deprecated— make sure you're using@langchain/openai'sChatOpenAI, not the legacyOpenAIChatfrom older releases.
Gateway URL: https://api.toygate.store