Four ways to run an AI request

Every request runs one of your workflows: the model you picked, backup models if it fails, and a log of every call. What changes between the four patterns is how the result gets back to you, and whether your backend is asked for data along the way.

Side by side

SyncAsyncBackend pipelineAgent
You callPOST /v1/aiPOST /v1/ai/asyncPOST /v1/ai/async on a workflow with backend stepsPOST /v1/ai/async on a workflow with tools
The call returnsThe full AI resultA channel, right away (202)A channel, right away (202)A channel, right away (202)
The result reachesYour server, in the HTTP responseYour users over WebSocket, and your webhooksYour users over WebSocket, after your backend stepsYour users over WebSocket, and your webhooks
Your backend during the runWaits for the responseFree; gets the result by webhookAnswers signed webhooks with your dataAnswers the tool calls the model makes
StreamingOptional, to your server (SSE)Token by token to the browserStep progress and the final resultTool progress, then the whole answer
Best forShort tasks: classify, extract, moderateChat answers and longer jobsAI features that need your data and rulesAssistants that look things up in your app

Not sure? Start with Sync. Move to Async when a user waits on a page or a request takes more than a few seconds. Add backend steps when the AI needs your data or your business rules in the middle of the run. Use an agent when the model should decide what to look up.

Already on the OpenAI SDK?

You can also call any workflow through OpenAI-compatible endpoints. Point your SDK at ModelRiver and use the workflow name as the model. It works like Sync, with optional streaming, and keeps failover, structured outputs and cost tracking.

  • POST /v1/chat/completions
  • POST /v1/completions
  • POST /v1/embeddings
  • GET /v1/models

Works with the OpenAI SDKs for Python and Node.js, LangChain, LlamaIndex, the Vercel AI SDK and other OpenAI-compatible clients. OpenAI compatibility docs

app.js
const client = new OpenAI({
  baseURL: "https://api.modelriver.com/v1",
  apiKey: process.env.MODELRIVER_API_KEY,
});

await client.chat.completions.create({
  model: "my_workflow", // your workflow name
  messages,
});

Same everywhere

Whichever pattern you use, every workflow gets the same safety net.

2 backups

Provider failover

If the primary model fails, ModelRiver tries up to two backup models before giving up.

Every call

Request logs

Each request, provider attempt, webhook and callback is logged with timing and cost.

Your keys

Bring your own keys

Requests go to providers with your API keys. You pay providers directly.

No key

Test mode

Run a workflow on sample data with no provider call, to build your integration first.

Ready to try a workflow?