Skip to main content

Open-source intelligent model router and multi-agent orchestrator. The open alternative to Sakana AI's Fugu.

Project description

PyPI version Python License GitHub stars Docs Website

By eulogik — building AI infrastructure for everyone.


Fugusashi

The Open-Source Alternative to Sakana AI's Fugu

Fugusashi (Japanese: 不縛 — "unbound, unrestrained") is an intelligent model router and multi-agent orchestrator. Named after Fugu Sashi — the famous Japanese pufferfish delicacy — because this router serves up the world's best AI models without the poison of vendor lock-in or the pricing of Sakana Fugu. It automatically picks the best model for each prompt, learns from every request via a CMA-ES coordinator inspired by Sakana's TRINITY paper, and runs entirely on your infrastructure.

Like Sakana Fugu. But Free. Live Demo · Docs · PyPI · GitHub


Why Fugusashi?

Sakana AI's Fugu is a proprietary model router. It works — but you can't see inside it, you can't train it on your own data, you can't self-host it, and you pay $5-30 per million tokens.

Fugusashi does everything Fugu does, but open, transparent, and self-hosting. It also adds a feedback loop that Fugu doesn't have — the router learns from every request and gets smarter over time.

Fugusashi vs Sakana AI Fugu

Feature Sakana Fugu Fugusashi
Model Routing ✅ Proprietary ✅ Open, transparent
Multi-Agent Orchestration ✅ Fugu Ultra 🔄 Phase 2
Self-Hosting ❌ Cloud-only ✅ Local-first, air-gapped
Cost $5-30/M tokens ✅ Free (pay only for model APIs)
Transparency ❌ Black box ✅ Every decision visible
Feedback Loop ❌ Static ✅ Learns from every request
Model Pool ❌ Fixed by Sakana ✅ You control
Training Data ❌ Proprietary ✅ Community + your traffic
Customization ❌ None ✅ Fine-tune on your data
License Proprietary ✅ MIT
Dashboard ✅ Open web dashboard
API Limited ✅ OpenAI-compatible

Quickstart

Install from PyPI

pip install fugusashi

Or from source

git clone https://github.com/eulogik/fugusashi.git
cd fugusashi
python3 -m venv .venv
source .venv/bin/activate
pip install -e .

Configure

Edit config.yaml to add your models:

default_model: "llama3.2-local"

models:
  - name: "llama3.2-local"
    provider: "ollama"
    model: "llama3.2:1b"
    api_base: "http://localhost:11434"
    cost_per_input_token: 0.0
    cost_per_output_token: 0.0
    capabilities: ["chat", "reasoning"]
    description: "Llama 3.2 1B (local, free)"

  - name: "gpt-4o-mini"
    provider: "openai"
    model: "gpt-4o-mini"
    cost_per_input_token: 0.00000015
    cost_per_output_token: 0.0000006
    capabilities: ["chat", "reasoning", "code", "creative"]
    description: "OpenAI GPT-4o-mini"

Run

fugusashi serve --config config.yaml
# → Fugusashi router listening on 0.0.0.0:6060

Use

# Auto-route — the router picks the best model
curl http://localhost:6060/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{"model":"auto","messages":[{"role":"user","content":"Say hello"}]}'

# Force a specific model
curl http://localhost:6060/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{"model":"llama3.2-local","messages":[{"role":"user","content":"Say hello"}]}'

Every response includes a routing_decision showing which model was picked, why, and with what confidence.


Architecture

Fugusashi Architecture

Tier 1 — Intelligent Model Router

Three routing strategies in priority order:

  1. SimilarityRouter — Uses sentence-transformers to find similar past prompts and route to the model that worked best. Gets smarter with every request via the feedback loop.
  2. CostRouter — Capability-aware routing with cost optimization. Respects prefer_local for air-gapped deployments.
  3. FallbackRouter — Always returns a result, even with no data.

Tier 2 — Multi-Agent Orchestrator (Phase 2)

A planning model that decomposes hard tasks into subtasks, assigns them to specialist models, and synthesizes results. Uses reinforcement learning (GRPO-style) to learn teamwork patterns.


API Reference

POST /v1/chat/completions

OpenAI-compatible. Set model: "auto" for intelligent routing.

Response includes routing_decision:

{
  "id": "fugu-698f0a66db98",
  "model": "llama3.2-local",
  "choices": [...],
  "routing_decision": {
    "model": "llama3.2-local",
    "confidence": 0.9,
    "strategy": "ensemble(cost)",
    "latency_ms": 0.05,
    "explanation": "Routed by capability fit + cost"
  }
}

GET /v1/models — List available models

GET /v1/routing/decisions — Recent routing decisions

GET /v1/stats — Aggregated stats (cost, tokens, per-model)

GET /v1/trace/{request_id} — Full request trace

POST /v1/routing/training — Seed similarity router

curl -X POST http://localhost:6060/v1/routing/training \
  -H "Content-Type: application/json" \
  -d '[{"prompt":"Write Python code","model":"gpt-4o-mini","score":0.95}]'

POST /v1/feedback/rate — Rate a response (1-5)

curl -X POST http://localhost:6060/v1/feedback/rate \
  -d '{"request_id":"fugu-698f0a66db98","rating":5}'

POST /v1/feedback/retrain — Rebuild similarity index from feedback

GET /v1/feedback/stats — Outcome statistics

GET /v1/feedback/rankings — Per-model win rates


Dashboard

Open http://localhost:6060/dashboard for a live view:

  • Overview: total requests, tokens, cost, avg routing latency
  • Model Usage: bar chart of which models are being picked
  • Strategy Distribution: cost vs similarity routing breakdown
  • Recent Decisions: live table of every routing decision

Auto-refreshes every 3 seconds. Light and dark themes.


Feedback Loop — The Killer Feature

Fugu's router is static. Fugusashi's learns from every request:

Route → Execute → Evaluate → Learn → (repeat)
  1. Route: Router picks a model for the prompt
  2. Execute: Model generates a response
  3. Evaluate: Track outcome (success/failure, cost, latency)
  4. Learn: Feed outcomes back into the similarity router
  5. Auto-Retrain: Every 10 requests, the similarity index rebuilds automatically

Outcomes are stored in .fugusashi_data/outcomes.jsonl — inspectable, shareable, yours.


Benchmarking

pip install fugusashi
fugusashi benchmark                      # Default 20-sample dataset
fugusashi benchmark --train --verbose    # With training data
fugusashi benchmark --train --json       # JSON output
fugusashi benchmark -d my_data.jsonl     # Custom dataset

Results:

Metric Without Training With Training
Accuracy 70% 85%
Code accuracy 60% 90%
Strategy 100% cost 60% cost / 40% similarity
Routing latency <1ms ~18ms

Custom dataset format (JSONL):

{"prompt":"How do I center a div?","expected_model":"gpt-4o-mini","category":"code"}
{"prompt":"What is 2+2?","expected_model":"llama3.2-local","category":"factual"}

Project Structure

fugusashi/
├── config.yaml              # Model pool + routing config
├── pyproject.toml           # Dependencies + metadata
├── LIVING.md                # Living development walkthrough
├── README.md                # This file
├── LICENSE                  # MIT
├── src/fugusashi/
│   ├── __init__.py
│   ├── __main__.py          # CLI: serve, benchmark
│   ├── server.py            # FastAPI app factory
│   ├── config.py            # Pydantic config from YAML
│   ├── providers.py         # LiteLLM multi-provider wrapper
│   ├── tracker.py           # Cost/routing transparency
│   ├── feedback.py          # Feedback loop + learning
│   ├── benchmark.py         # Benchmark runner
│   ├── api/
│   │   └── routes.py        # All API endpoints
│   ├── router/
│   │   ├── interface.py     # Abstract router protocol
│   │   ├── strategies.py        # Cost, Similarity, Fallback routers
│   │   └── ensemble.py      # Priority-chain ensemble
│   └── static/
│       └── dashboard.html   # Live web dashboard
├── tests/
│   └── test_integration.py  # Integration tests
└── docs/                    # GitHub Pages documentation

How It Beats Sakana AI's Fugu

  1. Transparent: Every routing decision is visible and explainable. No black box.
  2. Self-hosting: Runs entirely on-premise with local models via Ollama.
  3. Learning: Gets smarter from every request via the feedback loop. Fugu can't do this.
  4. Open: Community-owned preference datasets, not proprietary training data.
  5. Extensible: Add your own routing strategies via the plugin interface.
  6. Observable: Dashboard + stats + traces out of the box.
  7. Free: MIT licensed. No usage fees. No vendor lock-in.

Links


License

MIT — use it however you want.


Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fugusashi-1.0.0.tar.gz (33.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fugusashi-1.0.0-py3-none-any.whl (33.3 kB view details)

Uploaded Python 3

File details

Details for the file fugusashi-1.0.0.tar.gz.

File metadata

  • Download URL: fugusashi-1.0.0.tar.gz
  • Upload date:
  • Size: 33.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for fugusashi-1.0.0.tar.gz
Algorithm Hash digest
SHA256 814e3939116e24db2f8959ad3ffc3c3624c71f87f4a24eeb4646368d8e57b4d8
MD5 52e6b4ce24d26d22a3087ab66f1d0071
BLAKE2b-256 ccb9840217963ae0dbb4fc1d4800225e4c72afe99cc538435fc6e9b287712bb7

See more details on using hashes here.

File details

Details for the file fugusashi-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: fugusashi-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 33.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for fugusashi-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cac3736f8eac3e6975d66a61611c64f6bc7ef9871219e2c5d9088f80d35ddbf8
MD5 ee842205081cc449eb948407fb742f1a
BLAKE2b-256 70494027b05c9dec7591aeeab7c73ddcc39a2d513138c771555915fafed19c73

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page