Model reference · open weights

xRouter

LLMs Salesforce Text gen 1 build Non-commercial 78 dl/mo

xRouter is an open-weight language model from Salesforce. xRouter (FP32) weighs 15.2 GB; the smallest configuration that runs it is 2× RTX 3060 12 GB.

What it is

Released bySalesforce
Released2025-10-30
Parameters7.6B
VRAM15.2 GB for the weights

What it runs on

Memory and cards for xRouter (FP32)

15.2 GBweights, file size
57 MBcache per 1K tokens
799 MBruntime overhead, at least
32,768 tokenscontext max
CardRequests at onceContext maxMemory
8K each32K each
RTX 3060 12 GB … RTX 4060 Ti 16 GB
2 smaller cards
———
RTX 3090 24 GB153all 32K23.4 GB
RTX 4090 24 GB153all 32K23.4 GB
RTX 5090 32 GB317all 32K31.0 GB
L40S 48 GB5914all 32K44.0 GB
A100 80 GB13233all 32K78.2 GB
H100 80 GB12230all 32K78.1 GB
RTX PRO 6000 Blackwell 96 GB15639all 32K93.8 GB
DGX Spark (GB10) 128 GB unified18446all 32K107 GB
H200 141 GB25062all 32K138 GB
B200 180 GB32982all 32K176 GB
2× RTX 3060 12 GB
tensor parallel
133all 32K11.6 GB a card
2× RTX 4060 Ti 16 GB
tensor parallel
297all 32K15.4 GB a card
Memory needed at each load
Requests at once8K tokens each32K tokens each
116.5 GB17.9 GB
518.4 GB25.4 GB
819.8 GB31.1 GB
1623.5 GB46.1 GB
3231.1 GB76.2 GB
6446.1 GB136 GB

One card, with vLLM's small-card settings.

From the model card

What Salesforce says about xRouter

Welcome to xRouter, Salesforce AI Research's intelligent LLM routing system trained with reinforcement learning to dynamically select optimal models from 20+ available LLMs while optimizing for both performance and cost.

Modern LLM deployments face a widening cost-performance spectrum: premium models deliver strong reasoning but are expensive, while lightweight models are economical yet brittle on complex tasks. xRouter learns end-to-end routing policies that balance quality and cost through explicit cost-aware reward shaping, eliminating the need for hand-engineered routing rules.

Read the full model card

⭐ Highlights

  • Cost-Aware Optimization: RL-trained policies minimize costs (up to 60% reduction) while maintaining quality
  • Adaptive Routing: Dynamic model selection based on query complexity - routes simple queries to budget models, complex ones to premium models
  • Tool-Calling Architecture: Learns to effectively invoke 20+ models (GPT-5, o3/o4, DeepSeek R1, Qwen3, Kimi K2, etc.) and select best responses
  • Multi-Model Orchestration: Coordinates responses from multiple LLMs for complex reasoning tasks
  • Learned Prompt Engineering: Automatically generates optimized system prompts for target models

📊 Model Details

  • Developed by: Salesforce AI Research
  • Base Model: Qwen/Qwen2.5-7B-Instruct
  • Model Type: Instruction-tuned language model with tool-calling capabilities
  • Training Algorithm: DAPO (Distributional Advantage Policy Optimization) with cost-aware reward shaping
  • Training Data: Derived from Reasoning360 - math, code, reasoning, and STEM tasks
  • License: CC BY-NC 4.0 (Creative Commons Attribution-NonCommercial 4.0 International)

📈 Key Results

  • Substantial cost reductions (up to 60%) at comparable task completion rates
  • Evaluated on 17 diverse benchmarks spanning math, coding, reasoning, and OOD tasks
  • Adaptive behavior: Learns when to use premium vs. budget models without explicit rules
  • Multi-turn reasoning: Effectively coordinates multiple model calls for complex tasks

For detailed results, see our paper.

🛠️ Usage

Installation

# Clone the repository
git clone https://github.com/SalesforceAIResearch/xRouter.git
cd xRouter

# Set up environment
conda create -n xrouter python=3.12
conda activate xrouter

pip install uv
uv pip install torch==2.6.0
uv pip install flash-attn==2.7.3 --no-build-isolation
uv pip install -e .[gpu,math,vllm,test]
pip install litellm rich python-dotenv

Configure API Keys

export OPENAI_API_KEY="your_openai_key"
export TOGETHER_API_KEY="your_together_key"
export GEMINI_API_KEY="your_gemini_key"  # optional

🚀 Deployment

# Host the router model
cd evaluation
bash host_router.sh  # Serves on port 8000

# Launch the router API (in another terminal)
bash serve_router.sh  # Serves on port 8800

💬 Usage Example

import openai

# Initialize client
client = openai.OpenAI(
    base_url="http://localhost:8800/v1",
    api_key="dummy"
)

# Send request
response = client.chat.completions.create(
    model="router-tool-rl",
    messages=[
        {"role": "user", "content": "Solve: If x^2 + 2x + 1 = 0, what are the values of x?"}
    ],
    max_tokens=1000
)

print(response.choices[0].message.content)

# Access routing metadata
metadata = response.router_metadata
print(f"Model used: {metadata['model_used']}")
print(f"Total cost: ${metadata['total_cost']:.6f}")

🎓 Training Methodology

xRouter uses DAPO (Distributional Advantage Policy Optimization) with cost-aware reward shaping:

reward = quality - λ × normalized_cost

Training Features:

  • Cost-aware rewards penalize expensive routing decisions
  • Multi-turn credit assignment across conversation turns
  • Tool augmentation with 20+ model tools + response selection
  • Curriculum learning from simple to complex tasks

Supported Model Tiers:

TierModelsBest For
PremiumGPT-5, GPT-4.1, o3, Qwen3-235B-Instruct, Kimi K2Mission-critical tasks
StandardGPT-5-Mini, GPT-4.1-Mini, o4-Mini, GPT-OSS-120BBalanced performance
BudgetGPT-5-Nano, GPT-4.1-Nano, GPT-4o-Mini, GPT-OSS-20BHigh-volume tasks
Specializedo3, DeepSeek-R1, Qwen3-235B-Thinking, Qwen3-Coder-480BDomain-specific

📚 Citation

@article{qian2025xrouter,
  title={xRouter: Training Cost-Aware LLMs Orchestration System via Reinforcement Learning},
  author={Qian, Cheng and Liu, Zuxin and Kokane, Shirley and Prabhakar, Akshara and Qiu, Jielin and Chen, Haolin and Liu, Zhiwei and Ji, Heng and Yao, Weiran and Heinecke, Shelby and Savarese, Silvio and Xiong, Caiming and Wang, Huan},
  journal={arXiv preprint arXiv:2510.08439},
  year={2025}
}

🔗 Resources

🙏 Acknowledgements

This project builds upon exceptional work from the open-source community:

  • Reasoning360: Foundational RL training framework
  • VERL: RL infrastructure for distributed LLM training
  • SGLang: High-performance LLM serving backend
  • LiteLLM: Unified API interface for 20+ LLM providers

🏢 Developed by Salesforce AI Research

Quoted from the model card on Hugging Face. The full card is behind the Hugging Face link above.

© 2026 AxForge · EU-hosted AI infrastructure Pricing Docs Trust Privacy Terms