LangChain alternative
LangChain is powerful,but running it in production isn’t.
ModelRiver lets you build, test, and run reliable AI workflows without stitching tools together. Set up the models, backups and limits for each workflow in the console, then call it with one API, on its own or from LangChain.
Why teams look for a LangChain alternative
LangChain gives you building blocks. The production work around them is yours, and these are the parts teams most often end up building.
Backups when a provider fails
Fallbacks and retries live in your code, so every change to them is a new deploy.
Seeing what happened
Tracing a failed request needs a separate tool, such as LangSmith, connected to your chains.
Keeping costs in check
Spending caps and rate limits are code or infrastructure you build and look after.
Changing a model
Models and prompts sit in your code, so switching one means editing, testing and shipping it.
What ModelRiver does instead
Each workflow is set up once in the console. Your app, or LangChain, calls it by name.
from langchain_openai import ChatOpenAI
# Point LangChain at ModelRiver. model is your workflow’s name.
llm = ChatOpenAI(
base_url="https://api.modelriver.com/v1",
api_key="mr_live_...",
model="support-reply",
)
llm.invoke("Where is my order #4521?")Backups built in
Each workflow has a primary model and up to 2 backups. Errors, timeouts and rate limits move the request to the next one.
Every request logged
Provider, model, tokens, cost, duration and every attempt are in the request logs.
Answers in the shape you asked for
Give a workflow a JSON schema and every response is checked against it. A mismatch goes to the next backup.
Limits on spending
Cap spending per project and per model, so a loop in an agent can’t run up the bill.
LangChain vs ModelRiver
Two different kinds of tool. Here is what each one gives you.
| Topic | LangChain | ModelRiver |
|---|---|---|
| What it is | An open-source framework you run inside your app | A hosted AI backend you call over an API |
| Where models are set | In your code | In the console, per workflow |
| Provider backups | Fallbacks you write in code | Up to 2 backups per workflow |
| Request logs | Add a tracing tool such as LangSmith | Built in, with every attempt |
| Structured output | Output parsers in your code | JSON Schema checked on every response |
| Response cache | Set up in your code | Exact-match cache per workflow |
| Spending limits | Not included | Per project and per model |
| Chains, agents and retrieval | A large set of building blocks | Not a framework for these; use it with LangChain |
Which one fits
Use LangChain if
- You need full control over every component.
- You are building agents, chains or retrieval with many custom parts.
- You want an open-source library you host yourself.
Use ModelRiver if
- You want backups, logs and limits without building them.
- You want to change models without a code change.
- You want to keep LangChain and add these underneath it.
Many teams use both: LangChain for the logic, ModelRiver for the model calls.
Frequently asked questions
Is ModelRiver a full replacement for LangChain?
No. LangChain is a framework for building chains, agents and retrieval in code. ModelRiver runs the model calls, with backups, request logs, structured output and limits. Many teams use both.
Can I still use LangChain with ModelRiver?
Yes. Point ChatOpenAI at the ModelRiver API with your API key, and set model to a workflow name. Your chains and agents keep working.
Does streaming work through LangChain?
Yes. Streaming requests through the OpenAI-compatible API come back as server-sent events. Workflows with a structured output can’t be streamed.
What does ModelRiver cost?
There is a free plan with 25,000 requests a month. You use your own provider keys and pay your AI providers directly.
Docs and next reads
- LangChain guideConnect ChatOpenAI, embeddings and agents to ModelRiver. (opens in a new tab)
- Auto failoverHow a workflow moves to its backups when a provider fails. (opens in a new tab)
- DebuggingRead the request logs, step by step. (opens in a new tab)
- AI spending limitsCap spending per project and per model. (opens in a new tab)
Keep LangChain. Run it on ModelRiver.
Start on the free plan, create a workflow, and point ChatOpenAI at it.