# Router: Optimize AI Model Selection and Costs for Agentic Systems

This repository profile is provided by osrepos.com, an open source repository discovery platform.

Source: osrepos.com
Repository profile: https://osrepos.com/repo/weave-os-router
Generated for open source discovery and AI-assisted research.

The Weave-OS Router is an intelligent model router for agentic systems, optimizing AI model selection for every request. It acts as a drop-in proxy for major AI providers, routing prompts to the most suitable model in under 50ms. This solution helps users significantly cut costs, often by 40-70%, simply by changing an endpoint.

GitHub: https://github.com/weave-os/router
OSRepos URL: https://osrepos.com/repo/weave-os-router

## Summary

The Weave-OS Router is an intelligent model router for agentic systems, optimizing AI model selection for every request. It acts as a drop-in proxy for major AI providers, routing prompts to the most suitable model in under 50ms. This solution helps users significantly cut costs, often by 40-70%, simply by changing an endpoint.

## Topics

- Go
- AI
- Agentic Systems
- Model Router
- AI Gateway
- OpenAI Compatible
- Anthropic
- Development Tools

## Repository Information

Last analyzed by OSRepos: Mon Sep 28 2026 08:54:27 GMT+0100 (Western European Summer Time)
Detail views: 0
GitHub clicks: 0

## Safety Notice

OSRepos shares public repositories for knowledge and discovery only. Review source code, dependencies, licenses, and security implications before running or installing anything.

## Content

## Introduction

The `weave-os/router` is an innovative open-source project designed to revolutionize how agentic systems interact with large language models (LLMs). Acting as a smart proxy, it intelligently routes every prompt to the most appropriate AI model, ensuring optimal performance and significant cost reductions. With a single endpoint change, users can achieve 40-70% cost savings while leveraging the best models from providers like Anthropic, OpenAI, and Gemini. This project, written in Go, has garnered significant attention, boasting over 5,300 stars on GitHub.

## Why Use It and Key Benefits

The Weave-OS Router offers a compelling set of features that make it an essential tool for developers building agentic AI applications:

*   ? **Routes per action**: An advanced cluster scorer, derived from research like Avengers-Pro, picks the right model from your enabled providers for every upstream API request. This ensures that each action within your agentic system is handled by the most suitable LLM.
*   ? **Speaks everyone's API**: It supports a wide range of API formats, including Anthropic Messages, OpenAI Chat Completions, and Gemini native, along with features like streaming, tools, and vision capabilities.
*   ? **Knows OSS too**: Beyond commercial providers, the router integrates with open-source models such as DeepSeek, Kimi, GLM, Qwen, Llama, and Mistral via OpenRouter or any OpenAI-compatible endpoint.
*   ? **BYOK by default**: Provider keys remain on your local machine, encrypted at rest, ensuring enhanced security and control over your credentials.
*   ? **Observable**: Out-of-the-box OTLP traces provide deep observability, allowing you to monitor routing decisions and integrate with dashboards like Weave, Honeycomb, Datadog, or Grafana.

## Installation

Getting started with the Weave-OS Router is quick and straightforward.

### 30-second Quickstart (Hosted)

The fastest way to use the hosted Weave Router is with `npx`:

bash
npx @weave-os/router


This command opens the hosted setup page in your browser. You can also choose a target explicitly:

bash
npx @weave-os/router --claude              # skip the picker, Claude Code
npx @weave-os/router --local               # self-hosted localhost:8080


Requires Node ? 18. For a full flag reference, see the [install/npm/README.md](https://github.com/weave-os/router/blob/main/install/npm/README.md){:target="_blank"} file.

### Self-host the Whole Stack

For a self-hosted solution running the router and dashboard on your own machine:

1.  **Drop a provider key in.** OpenRouter is recommended as a baseline.
    bash
    echo "OPENROUTER_API_KEY=sk-or-v1-..." >> .env.local
    
2.  **Set a dashboard password.**
    bash
    echo "ROUTER_ADMIN_PASSWORD=replace-with-a-strong-password" >> .env.local
    
3.  **Boot Postgres + router on :8080 and seed an rk_ key.**
    bash
    make full-setup
    

The router will be accessible at `http://localhost:8080` and the dashboard at `http://localhost:8080/ui/`.

## Examples

Once the router is running, you can interact with it using standard API calls:

### Call it like Anthropic

bash
curl -sS http://localhost:8080/v1/messages \
  -H "Authorization: Bearer rk_..." \
  -d '{"model":"claude-sonnet-4-5","max_tokens":256,
       "messages":[{"role":"user","content":"hi"}]}'


### Or like OpenAI

bash
curl -sS http://localhost:8080/v1/chat/completions \
  -H "Authorization: Bearer rk_..." \
  -d '{"model":"gpt-4o-mini",
       "messages":[{"role":"user","content":"hi"}]}'


### Peek at the routing decision without proxying

bash
curl -sS http://localhost:8080/v1/route -H "Authorization: Bearer rk_..." -d '...'


## Links

For more detailed information, documentation, and to contribute to the project, please visit the official resources:

*   **GitHub Repository**: [https://github.com/weave-os/router](https://github.com/weave-os/router){:target="_blank"}
*   **Official Website**: [https://www.workweave.ai](https://www.workweave.ai){:target="_blank"}
*   **License**: [Apache License 2.0](https://github.com/weave-os/router/blob/main/LICENSE){:target="_blank"}
*   **Configuration Reference**: [docs/CONFIGURATION.md](https://github.com/weave-os/router/blob/main/docs/CONFIGURATION.md){:target="_blank"}
*   **Semantics and Terminology**: [docs/SEMANTICS.md](https://github.com/weave-os/router/blob/main/docs/SEMANTICS.md){:target="_blank"}
*   **Analytics Export**: [docs/ANALYTICS_EXPORT.md](https://github.com/weave-os/router/blob/main/docs/ANALYTICS_EXPORT.md){:target="_blank"}
*   **Contributing Guide**: [CONTRIBUTING.md](https://github.com/weave-os/router/blob/main/CONTRIBUTING.md){:target="_blank"}