Skip to content
On this page

Integrations

LangChain

Use RelayRouter as the base URL for LangChain's [OI] chat model.

LangChain's [OI] integration accepts a custom base URL, so any RelayRouter model works as a drop-in chat model.

Python

import os
from langchain_openai import Chat[OI]
llm = Chat[OI](
model="deepseek-v4.1-flash",
base_url="https://api.relayrouter.org/v1",
api_key=os.environ["RELAY_API_KEY"],
temperature=0.7,
)
response = llm.invoke("Explain prompt caching in two sentences.")
print(response.content)

TypeScript

import { Chat[OI] } from "@langchain/openai";
const llm = new Chat[OI]({
model: "deepseek-v4.1-flash",
apiKey: process.env.RELAY_API_KEY,
configuration: {
baseURL: "https://api.relayrouter.org/v1",
},
});
const response = await llm.invoke("Hello from RelayRouter");

Tool calling and streaming follow the standard LangChain [OI] behavior. Choose a model with tool support if your chain uses tools.