Run LangChain on Mingles Router
LangChain's OpenAI integration takes the endpoint as a constructor argument. Swap it and every chain, agent and tool binding above it keeps working.
Pick your model and paste your key — every command and value on this page updates live.
Endpoint: https://router.mingles.ai/v1 · key stays in your browser ·
no key entered? commands show <your-key>.
Wire it up
1. Python
Install langchain-openai, then construct the model with the endpoint:
from langchain_openai import ChatOpenAI
llm = ChatOpenAI(
model="deepseek-ai/DeepSeek-V4-Flash-0731",
base_url="https://router.mingles.ai/v1",
api_key="<your-key>",
)
print(llm.invoke("Hello").content) 2. JavaScript / TypeScript
The JS package puts the endpoint under configuration, not at the top level — this is the line people get wrong:
import { ChatOpenAI } from "@langchain/openai";
const llm = new ChatOpenAI({
model: "deepseek-ai/DeepSeek-V4-Flash-0731",
apiKey: "<your-key>",
configuration: { baseURL: "https://router.mingles.ai/v1" },
}); 3. Or set it once in the environment
If you would rather not touch the code, LangChain picks these up:
export OPENAI_API_KEY="<your-key>"
export OPENAI_BASE_URL="https://router.mingles.ai/v1" Exact values
| base_url | https://router.mingles.ai/v1 |
| api_key | <your-key> |
| model | deepseek-ai/DeepSeek-V4-Flash-0731 |
Switch model
Bind tools, structured output and streaming all work as they do against OpenAI — they are chat-completions features, and that is the dialect we serve.
Before you file a bug: read the limits
Reasoning models spend the output budget on internal thinking, output is capped at 8192 tokens, there is no KV cache, and there are no built-in web tools. Most “it broke on Mingles Router” reports are one of these. See Model limits & behavior →
Frequently asked
Do embeddings work too? +
No. OpenAIEmbeddings would need an /v1/embeddings endpoint, and we serve chat completions only. Keep embeddings on a provider that offers them — a chain can use two different services.
Should I use ChatOpenAI or the older OpenAI class? +
ChatOpenAI. The completion-style class targets the legacy /v1/completions endpoint, which is not what modern models are served on.