Rouva Docs
Everything you need to connect your app to Rouva — from a quick start to the full API reference.
Updated on September 12, 2026
Quick start
Connect your app to Rouva in three steps. No infrastructure changes required.
-
Create an account
Sign up at app.rouva.io and connect one or more AI provider API keys in Settings. -
Generate your Rouva gateway key
Go to Integrations in your dashboard and click Generate API key. Your key starts with rva_. -
Route your first request
Use the SDK or call the gateway directly. Rouva handles the rest.
SDK
The official Node.js SDK is the fastest way to integrate. One client, any connected provider — drop-in compatible with the OpenAI SDK.
Install
npm install @rouvanpm/rouva
Usage
import { Rouva } from '@rouvanpm/rouva'
const rouva = new Rouva({ apiKey: 'rva_your_key' })
const response = await rouva.chat.completions.create({
messages: [{ role: 'user', content: 'Your prompt here' }],
})
Already using OpenAI or Anthropic?
Change two lines. Rouva uses the same message format — your existing code works as-is.
// Before (OpenAI) import OpenAI from 'openai' const openai = new OpenAI({ apiKey: '...' }) const res = await openai.chat.completions.create({ messages, model: 'gpt-4o' }) // Before (Anthropic) import Anthropic from '@anthropic-ai/sdk' const anthropic = new Anthropic({ apiKey: '...' }) const res = await anthropic.messages.create({ messages, model: 'claude-sonnet-4-6', max_tokens: 1024 }) // After — one client, any provider, intelligently routed import { Rouva } from '@rouvanpm/rouva' const rouva = new Rouva({ apiKey: 'rva_...' }) const res = await rouva.chat.completions.create({ messages, model: 'gpt-4o' }) // model optional
Options
| Option | Type | Required | Description |
|---|---|---|---|
| apiKey | string | Required | Your rva_ gateway key from the dashboard |
| baseURL | string | Optional | Override the default gateway URL |
API reference
All three endpoints require Authorization: Bearer rva_your_key and Content-Type: application/json.
Agent tools
The gateway passes tool conversations through untouched: tools and tool_choice, OpenAI-style assistant tool_calls and role: "tool" messages, and Anthropic-style tool_use/tool_result content blocks are all forwarded byte-for-byte to the chosen model. Write your tools in the schema of the provider that owns your pinned model.
Stop reason caveat: When tool_choice forces a specific function on an OpenAI-format provider, the response may return finish_reason: "stop" even though tool_calls are present. Detect tool invocations from the response content, not the stop reason — for OpenAI-format providers check for tool_calls in the deltas (or on message when stream: false); for Anthropic check for tool_use content blocks.
Session tracking
Tag all turns of an agent run with a shared session ID. Pass x-rouva-session-id as a request header, or use rouva.startSession() in the SDK — the ID is stored on each snapshot and visible in the request log. Call rouva.endSession() when the run is complete so subsequent requests are not grouped into the same session.
POST /api/gateway/messages Authorization: Bearer rva_your_key x-rouva-session-id: my-agent-run-001 Content-Type: application/json
Cross-provider harness
The agentic /run endpoint includes a canonical translation layer — a provider-neutral representation of messages, tool calls, and tool results. With Intelligent Routing enabled, the gateway selects a model across your connected Anthropic and OpenAI-compatible providers once before the loop starts, then uses that provider for all turns. Automatic routing always picks a model at or below the pinned model's cost; Routing Overrides are applied as policy and are not price-constrained. You can write tools in either OpenAI or Anthropic format — the gateway detects the dialect by shape and re-serializes to whatever the selected model expects.
Cross-dialect routing is conditional on the session being translatable. The restrictions apply to cross-provider candidate selection — the automatic within-provider fallback (substituting a cheaper model on the same provider) is unaffected. Routing Overrides targeting the same provider are also subject to the dialect gate: an override whose target model uses the opposite dialect may be skipped when the session contains opaque content for that dialect. Each set of conditions blocks cross-provider selection targeting a particular dialect while leaving the other eligible:
- Blocks routing to OpenAI-compatible providers (Anthropic targets remain eligible): Anthropic images, document blocks, thinking blocks, or cache_control on messages, text blocks, tool schemas, or tool results; is_error on tool results; documents or images nested in tool result content; thought_signature or other Anthropic-specific fields on tool calls.
- Blocks routing to Anthropic (OpenAI-compatible targets remain eligible): developer-role messages; untranslatable OpenAI content parts (file, audio blocks — image_url is translated automatically only in tool-result content; in user or assistant messages it is opaque); reasoning_content, audio, or refusal fields; participant name; strict or other OpenAI-specific fields on tool schemas (top-level or inside function); malformed or non-object tool-call arguments; untranslatable tool-result content parts or tool-result metadata extensions.
- Never crosses dialect groups: routing between two OpenAI-compatible providers (e.g. OpenAI → DeepSeek, Gemini → Alibaba) is not performed — vendor-specific extensions would not transfer safely across those providers.
Tool schema formats
Both tool schema formats are accepted in the tools array:
// OpenAI tool format { "type": "function", "function": { "name": "get_weather", "description": "Get weather for a city", "parameters": { "type": "object", "properties": { "city": { "type": "string" } }, "required": ["city"] } } } // Anthropic tool format — also accepted { "name": "get_weather", "description": "Get weather for a city", "input_schema": { "type": "object", "properties": { "city": { "type": "string" } }, "required": ["city"] } }
What the canonical layer does
On every /run turn, the gateway:
- Detects each tool's format by shape — OpenAI (type:"function" or a function key) or Anthropic (input_schema) — regardless of which provider the model is on.
- Normalizes all messages into a provider-neutral canonical form, preserving tool call IDs, arguments, names, and result content verbatim.
- Selects the target provider once before the loop starts — via Intelligent Routing across all your connected providers, or your pinned model. That provider is used for all turns.
- Re-serializes the full conversation history for the target provider's wire format — OpenAI tool_calls/role:"tool" or Anthropic tool_use/tool_result blocks — automatically.
- Forwards to the upstream model and merges the response back into the session history.
System messages are hoisted to Anthropic's top-level system parameter when routing to Claude, and inlined as role:"system" for OpenAI — no client changes required.
Same-provider verbatim replay
Tool schemas whose format matches the target provider are replayed verbatim — preserving vendor extensions like strict (OpenAI) or cache_control (Anthropic) exactly as you defined them. Cross-format schemas are normalized through the canonical layer.
Tip: Cross-provider routing requires Intelligent Routing to be enabled. The selected provider is fixed for the entire session — all turns use the same provider. Untranslatable content blocks routing to the incompatible target dialect (see the direction-specific restrictions above) while leaving the other dialect eligible.
Routing overrides
Routing overrides let you pin specific models to specific task types at the account level — as an enforced policy, not a hint. When an override is active for a task type, Rouva ignores the model the caller requested and routes to your override model instead, regardless of which endpoint or SDK is used.
How to configure
In your dashboard, go to Settings → Intelligent Routing. For each task type (Creative, Code, Analysis, etc.) you can select any model from your connected providers. Save the override — it takes effect immediately on all subsequent requests.
How it works
Every non-tools request is classified by task type (Creative, Code, Summarize, etc.) before routing. If an override exists for the detected task type and Intelligent Routing is enabled, the override model is selected — even if the caller explicitly requested a different model. The dashboard request log marks these rows with an ⊕ override badge so you can see when policy applied.
Caveats
- Intelligent Routing must be enabled. Overrides are inactive when IR is turned off — the caller's model is used as-is.
- Sampling compatibility. Overrides are skipped when the request includes parameters that would cause an upstream error — a seed with a non-OpenAI override, or top_p/stop with an OpenAI reasoning model. temperature on a reasoning-model override is silently omitted rather than a skip condition.
- Tools overrides stay within the same provider. Tool schemas are provider-specific, so an override only applies when it targets the same provider as the pinned model — for example, a gpt-4o tools request can override to gpt-4.1-mini (both OpenAI), but not to claude-sonnet-5 (Anthropic schemas differ). Cross-provider overrides are silently skipped and the pinned model is used.
- Cross-provider on /v1 is non-streaming only. When a /v1 request routes to an Anthropic override, streaming (stream: true) is not yet translated — /v1 defaults to non-streaming, so this is rarely encountered.
Team controls
Rouva supports multi-member workspaces. As the workspace owner you can invite team members, set per-member spend caps, and restrict which models each member can access.
Inviting members
Go to the Team page in your dashboard and enter a colleague's email address. An invite link is sent — invite links expire after 7 days. Once the invitee accepts, they are added as a workspace member and can route requests through your connected provider keys. If the invitee already has an rva_… key, it becomes workspace-aware automatically — no action needed. If they don't yet have a key, they must go to the Gateway page in their dashboard and generate one after accepting.
Spend caps
Click Edit next to any member to open their settings panel. Enter a monthly USD cap in the Spend cap field and click Save cap. Once a member's month-to-date spend reaches the cap, all subsequent gateway requests from their key are rejected with 429 Too Many Requests and a Retry-After header set to the number of seconds until the cap resets at the next UTC month start. The cap resets automatically on the 1st of each month (UTC), or the workspace owner can raise it at any time.
Spend alerts for members
When a member's month-to-date spend crosses 80% or 100% of their cap, Rouva automatically sends an email alert — no configuration required beyond setting the cap. Two emails go out per threshold crossing:
- Member alert — sent to the member's account email, showing their current spend, cap, and usage percentage.
- Owner alert — sent to the workspace owner's account email, identifying which member triggered the alert.
Alerts are deduplicated per threshold per day — each threshold (80% and 100%) fires at most once per member per 24-hour window, even if the member makes many requests. If a single gateway request takes the member past both thresholds at once, only the 100% notification is delivered — the 80% alert is skipped. If your workspace has a Slack webhook configured, the owner also receives a Slack notification for each threshold crossing.
Model restrictions
In the same Edit panel, expand providers under Model restrictions and check the models you want to allow. Saving with no boxes checked means all models are available (no restrictions). When a member requests a disallowed model, the gateway transparently reroutes to the permitted model with the lowest input-token price within an eligible set and only returns 403 if none exists. On /api/gateway/messages, tools requests restrict the fallback to models on the same provider (tool schemas are provider-specific); non-tools requests can cross providers freely. On /api/gateway/run, cross-provider fallbacks are allowed between dialect groups (e.g. OpenAI-compatible → Anthropic) but same-dialect cross-provider routing is excluded (e.g. OpenAI → DeepSeek). Two additional direction-specific exclusions apply: Anthropic providers are excluded as fallbacks when the request contains a developer role message, OpenAI-specific tool schema extensions (e.g. strict), or other OpenAI-dialect-only content; and non-Anthropic providers are excluded when the request contains Anthropic-only metadata such as cache_control, thinking blocks, or is_error on a tool result. If the only permitted model sits in the excluded dialect, the request returns 403. Restrictions are scoped to that member and do not affect other members or your own key.
Revoking access
Click Remove on any member row to revoke that member's workspace access. Their existing rva_… key is not deleted immediately — it continues to exist but will no longer authenticate as a workspace member. Pending invites can be cancelled from the Pending invites list before they are accepted.
Supported models
Pass any of these model IDs in the model field to override routing. Make sure the relevant provider key is connected in your dashboard Settings.
Anthropic
Complex reasoning, coding, and long-context work.
claude-fable-5-1
claude-fable-5
claude-opus-5
claude-opus-4-8
claude-opus-4-7
claude-opus-4-6
claude-sonnet-5
claude-sonnet-4-6
claude-haiku-4-5-20251001
OpenAI
General-purpose, coding, and vision-heavy tasks.
gpt-5-nano
gpt-5-mini
gpt-5.4-mini
gpt-5
gpt-5.6-luna
gpt-5.6-terra
gpt-5.6-sol
gpt-4.1-nano
gpt-4.1-mini
gpt-4.1
gpt-4o
gpt-4o-mini
Google Gemini
Fast multimodal and long-context reasoning.
gemini-3.8-flash
gemini-3.7-flash
gemini-3.6-flash
gemini-3.5-flash-lite
gemini-2.5-flash
gemini-2.5-pro
xAI Grok
Chat, coding, and knowledge work.
grok-4.6
grok-4.5
grok-4.3
grok-4.20-0309-reasoning
DeepSeek
Strong coding and reasoning with efficient pricing.
deepseek-flash-4-1
deepseek-v4-flash
deepseek-v4-flash-think
deepseek-v4-pro
Mistral
Lightweight European models for deterministic workloads.
mistral-small-latest
mistral-large-latest
Moonshot Kimi
Coding, research, and agent workflows.
kimi-k2.6
kimi-k3
Z.ai
Long-horizon agent workflows and lightweight tasks.
glm-5.3
glm-5.2
glm-4.7-flash
Alibaba Qwen
High-throughput Chinese frontier models at competitive pricing.
qwen3-235b-a22b
qwen3-32b
qwen3-30b-a3b
qwen-plus
qwen-turbo
qwen-max
Ready to get started?
Create your account, connect a provider, and make your first routed request in minutes.
Get started free →