Frameworks
Connect nRouter to popular AI frameworks including LangChain, LlamaIndex, Vercel AI SDK, CrewAI, AutoGen, and Instructor via OpenAI-compatible endpoints.
nRouter provides drop-in OpenAI-compatible endpoints (https://api.nrouter.ai/v1) that connect to any AI framework or autonomous agent without custom client plugins or code rewrites.
Key capabilities:
- Zero-refactor client integration: Point any standard OpenAI client integration at
https://api.nrouter.ai/v1using yoursk-nrouter-...virtual key. - Server-side policy enforcement: Guardrails, prompt injection filtering, PII redaction, and tenant rate limits execute before requests reach upstream providers.
- Transparent cost attribution: Every priced response returns exact provider list rates in
x-nr-request-costwith zero token markup. - Automated model resilience: Configured fallback chains re-route requests if an upstream provider encounters admission failures or rate limits.
Supported Frameworks
| Framework | Best for | Guide |
|---|---|---|
| LangChain | Chains, agents, RAG | Setup → |
| LlamaIndex | Document indexing, RAG | Setup → |
| Vercel AI | Next.js / React UIs | Setup → |
| CrewAI | Multi-agent orchestration | Setup → |
| AutoGen | Microsoft agent framework | Setup → |
| Instructor | Structured outputs, Pydantic validation | Setup → |
| Claude Code | Anthropic's coding agent behind a gateway | Setup → |
| Cursor | Editor chat models with a custom provider key | Setup → |
| OpenClaw | Agent workflows on OpenAI-compatible routes | Setup → |
Built-in Gateway Controls
All policies execute server-side without changing client code:
- Guardrails — PII detection, redaction, prompt injection filtering, and keyword blocks.
- Caching — Answer repeat prompts directly from edge cache.
- Prompt templates — Centrally managed system prompts injected at the gateway.
- Rate & budget caps — Per-key and per-organization RPM/TPM limits with hard USD spend ceilings.
- Cost tracking — Exact provider list prices in
x-nr-request-cost(omitted when unpriced;x-nr-cost-statusreportsexactorunpriced) with zero token markup. - Model fallbacks — Automatic failover to configured fallbacks when an upstream provider cannot take a request.
Was this page helpful?