LangChain meets every model.
OminiGate exposes an OpenAI-compatible API at https://api.ominigate.ai/v1, so LangChain's ChatOpenAI, OpenAIEmbeddings, agents, and RAG chains plug in by changing two values: base URL and API key.
Why developers route LangChain through OminiGate
All the LangChain abstractions you already use — backed by a single, predictable gateway.
One key, one balance
A single sk-omg- key works across every model, every chain, every agent. Top up once and stop juggling per-provider keys and accounts.
Drop-in OpenAI compatibility
LangChain's ChatOpenAI and OpenAIEmbeddings classes already speak the OpenAI wire format. Point them at https://api.ominigate.ai/v1 and every model in the catalog answers the same way.
Reach beyond LLMs
Mix text, image, and video models inside one application. Your LangChain chain can call openai/gpt-5 today and a video generation model from the same balance tomorrow.
Transparent usage tracking
Every chain, agent step, and embedding call is itemised in the OminiGate dashboard with per-model and per-call cost — no separate billing screens to reconcile.
Real LangChain examples
Copy these snippets verbatim, swap in your own sk-omg- key, and they run.
1. Basic ChatOpenAI client
The shortest path: change base_url / configuration.baseURL and pass your OminiGate key. No other LangChain code has to change.
# pip install langchain langchain-openai
from langchain_openai import ChatOpenAI
llm = ChatOpenAI(
model="openai/gpt-5",
base_url="https://api.ominigate.ai/v1",
api_key="sk-omg-your-api-key",
temperature=0.2,
)
print(llm.invoke("Summarise the OminiGate value proposition in two sentences."))
2. LangChain agent with tool calling
Tool-calling agents work because OminiGate forwards OpenAI-format function/tool definitions transparently. Pick any chat model that supports tools — Anthropic, OpenAI, or Google — by slug.
from langchain_openai import ChatOpenAI
from langchain.agents import create_tool_calling_agent, AgentExecutor
from langchain_core.prompts import ChatPromptTemplate
from langchain_core.tools import tool
@tool
def get_pricing(model_slug: str) -> str:
"""Look up published per-million-token pricing for an OminiGate model."""
# call your own pricing service here
return f"placeholder pricing for {model_slug}"
llm = ChatOpenAI(
model="anthropic/claude-sonnet-4",
base_url="https://api.ominigate.ai/v1",
api_key="sk-omg-your-api-key",
)
prompt = ChatPromptTemplate.from_messages([
("system", "You are a helpful pricing assistant."),
("human", "{input}"),
("placeholder", "{agent_scratchpad}"),
])
agent = create_tool_calling_agent(llm, [get_pricing], prompt)
executor = AgentExecutor(agent=agent, tools=[get_pricing], verbose=True)
executor.invoke({"input": "How much is openai/gpt-5 per million tokens?"})
3. Retrieval-Augmented Generation (RAG)
Use OminiGate's embeddings models for the vector store and a chat model for the final answer. Both calls share the same key and balance, and both show up under one dashboard.
from langchain_openai import ChatOpenAI, OpenAIEmbeddings
from langchain_core.prompts import ChatPromptTemplate
from langchain_core.runnables import RunnablePassthrough
from langchain_core.output_parsers import StrOutputParser
from langchain_community.vectorstores import FAISS
embeddings = OpenAIEmbeddings(
model="openai/text-embedding-3-large",
base_url="https://api.ominigate.ai/v1",
api_key="sk-omg-your-api-key",
)
vectorstore = FAISS.from_texts(
["OminiGate exposes one OpenAI-compatible API for text, image, and video."],
embedding=embeddings,
)
retriever = vectorstore.as_retriever()
llm = ChatOpenAI(
model="openai/gpt-5",
base_url="https://api.ominigate.ai/v1",
api_key="sk-omg-your-api-key",
)
prompt = ChatPromptTemplate.from_template(
"Answer using only the context.\n\nContext: {context}\n\nQuestion: {question}",
)
chain = (
{"context": retriever, "question": RunnablePassthrough()}
| prompt
| llm
| StrOutputParser()
)
print(chain.invoke("What does OminiGate cover?"))
What teams build on this
Common LangChain patterns that benefit from a unified gateway.
Multi-model agent stacks
Route reasoning steps to a high-capacity model and cheaper sub-steps to a smaller one — without managing multiple SDKs, billing accounts, or rate-limit dashboards.
RAG over private corpora
Embed documents with text-embedding-3-large, store vectors locally, then answer with the chat model best suited to your domain. One key powers both halves of the chain.
Customer-facing copilots
Build production chatbots and copilots on top of LangChain. Switch providers per request based on cost, latency, or capability — no code changes required, only the model slug.
Cross-modal pipelines
Pair a LangChain chain with image or video generation calls inside the same workflow. Funded from the same OminiGate balance, billed line-by-line.
Migrate an existing LangChain project
Swap two lines and your chains, agents, and RAG pipelines start running through OminiGate.
From OpenAI direct
Add base_url, change the API key prefix, and prefix the model slug with the provider namespace OminiGate uses (e.g. openai/gpt-5).
- from langchain_openai import ChatOpenAI
-
- llm = ChatOpenAI(model="gpt-4o", api_key="sk-...")
+ from langchain_openai import ChatOpenAI
+
+ llm = ChatOpenAI(
+ model="openai/gpt-5",
+ base_url="https://api.ominigate.ai/v1",
+ api_key="sk-omg-your-api-key",
+ )
From OpenRouter
Replace the base URL and API key. Model slug format is the same provider/model convention you already use, so most chains keep working unchanged.
- llm = ChatOpenAI(
- model="openai/gpt-4o",
- base_url="https://openrouter.ai/api/v1",
- api_key="sk-or-...",
- )
+ llm = ChatOpenAI(
+ model="openai/gpt-5",
+ base_url="https://api.ominigate.ai/v1",
+ api_key="sk-omg-your-api-key",
+ )
Frequently asked questions
How do I point LangChain at OminiGate?
Set base_url (Python) or configuration.baseURL (TypeScript) to https://api.ominigate.ai/v1 on ChatOpenAI / OpenAIEmbeddings, and pass your sk-omg- API key. No other ChatOpenAI configuration has to change.
Does streaming work?
Yes. Use streaming=True (Python) or .stream() (TypeScript) exactly as you would with OpenAI direct. OminiGate proxies the OpenAI streaming format transparently for any model that supports it.
Does function / tool calling work?
Yes. Tool calling, structured outputs, and JSON mode all flow through unchanged for models that support them — including the OpenAI, Anthropic, and Google chat families exposed via OpenAI-compatible endpoints.
Can LangChain agents call multiple tools per turn?
Yes. create_tool_calling_agent and AgentExecutor work as designed. Pick a model that supports parallel tool calling if you want multiple tools dispatched in one round trip.
How do error codes look?
Errors follow the OpenAI error envelope, so LangChain's existing retry and fallback wrappers (such as RunnableWithFallbacks) work without modification. Authentication failures return a 401 with a clear message about the key.
How do I track LangChain costs?
Every request shows up in the OminiGate dashboard under Usage with model slug, input/output tokens, and cost. You can also use LangChain's get_openai_callback context manager — token counts come straight from OminiGate's response payloads.
Which embeddings model should I use?
openai/text-embedding-3-large is a strong default for English and multilingual retrieval. Switch to a smaller embedding model for cost-sensitive paths — only the model slug changes, the rest of your RAG chain is unaffected.
Can I use image or video models from inside a chain?
Yes. Call the OminiGate image or video endpoints from a LangChain @tool or a Runnable wrapper, then feed the result back into the chain. The same API key authenticates every modality, so there is nothing extra to configure.
Ship your next LangChain app on OminiGate
Create a key in the dashboard, point your ChatOpenAI client at https://api.ominigate.ai/v1, and your existing chains light up.