RouteNexRouteNex / docs
GitHub ↗
GETTING STARTED

Setup & Quick Start Guide

5 flexible ways to integrate RouteNex into your applications, SDKs, agents, and IDEs.

1

Direct REST API (/v1/chat/completions & /v1/messages)

Send requests directly to RouteNex. Use model: "auto" for deterministic auto-routing, or append OpenRouter tags like :free or :nitro:

curl http://localhost:3001/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer rn-local-dev-default" \
  -d '{
    "model": "auto:free",
    "messages": [
      { "role": "user", "content": "Explain quantum teleportation in 2 sentences" }
    ]
  }'
2

Drop-in OpenAI & Anthropic SDK Replacement

Switch your existing OpenAI SDK client by updating only two parameters:

from openai import OpenAI

client = OpenAI(
    base_url="http://127.0.0.1:3001/v1",  # Local daemon or https://api.routenex.com/v1
    api_key="rn-local-dev-default"        # Or your scoped virtual key
)

response = client.chat.completions.create(
    model="auto",
    messages=[{"role": "user", "content": "Optimize this SQL query"}]
)
print(response.choices[0].message.content)
3

Multi-Turn Agent Tool Execution Loop

RouteNex preserves full tool definitions, JSON schemas, and function calls across fallback boundaries:

response = client.chat.completions.create(
    model="combo/coding-power",
    messages=[{"role": "user", "content": "What is the weather in Tokyo?"}],
    tools=[{
        "type": "function",
        "function": {
            "name": "get_weather",
            "description": "Fetch real-time weather",
            "parameters": {
                "type": "object",
                "properties": {"location": {"type": "string"}},
                "required": ["location"]
            }
        }
    }]
)
4

One-Command Coding Agent CLI Launcher

Launch your favorite coding agents with isolated per-process environment variables:

routenex run claude --model auto
routenex run cursor
routenex run cline
routenex run aider --model combo/coding-power
5

Model Context Protocol (MCP) Server

Connect Claude Code, Cursor, or Cline to RouteNex’s built-in MCP server for live model inspection and combo management:

Stdio Mode (Claude Desktop / Cursor):routenex --mcp
Remote HTTP / SSE Endpoint:POST http://127.0.0.1:3001/v1/mcp