Skip to main content

Fuse multiple AI models and judge the best answer for coding

Project description

Fuse Fable

ฟิวชั่นหลาย AI model พร้อมกัน แล้วเลือกคำตอบที่ดีที่สุดสำหรับงานโค้ด — latency ≈ x2 (ยิงทุกตัวขนานกัน + judge รอบเดียว) ไม่ใช่ x7–x15

ใช้ได้หลายรูปแบบ: CLI, MCP server (เชื่อม Cursor/VS Code/Claude), และ subagent/pipe (ให้ tool หรือสคริปต์อื่นเรียก)

ติดตั้ง

pip install fusefable            # หลัก
pip install "fusefable[mcp]"     # ถ้าจะใช้เป็น MCP server

หรือจาก source:

git clone https://github.com/proultrax9/fusefable.git
cd fusefable
pip install -e ".[mcp]"

ตั้งค่า (ครั้งแรก)

fusefable config
  • เลือก AI Gateway → ใส่ key เดียวพอ แล้วถาม "จะใช้กี่โมเดล?" → วนถามทีละตัว
    • รองรับหลายเจ้า (เติม URL อัตโนมัติ): openrouter, groq, together, fireworks, deepinfra, novita, hyperbolic, aimlapi, portkey, deepseek, openai — เจ้าอื่นก็ใช้ได้ แค่พิมพ์ base_url เอง
  • หรือ Provider เดี่ยว → ถามว่าจะใช้กี่เจ้า แล้วใส่ base_url + ชื่อ env ของ key แต่ละเจ้า

ตั้ง API key เป็น environment variable ตามชื่อที่ wizard ถาม:

export OPENROUTER_API_KEY=sk-...      # macOS/Linux
setx OPENROUTER_API_KEY "sk-..."      # Windows (เปิด terminal ใหม่หลังตั้ง)

config ถูกเก็บที่ ~/.fusefable/config.yaml

1) ใช้เป็น CLI

fusefable ask "เขียนฟังก์ชัน quicksort ใน Python"
fusefable ask --show-all "..."             # ดูคำตอบทุกตัว + เหตุผล judge
fusefable ask --models gpt-5,qwen3-coder "..."   # เลือกเฉพาะบางตัว
fusefable ask --cheap "..."                # ใช้ cheap_models ใน config
ff ask "..."                                # alias สั้น

2) ใช้เป็น subagent / ต่อ pipe (ให้ tool อื่นเรียก)

fusefable ask --quiet "..."                # พิมพ์เฉพาะคำตอบ (ไม่มี header)
echo "อธิบายโค้ดนี้" | fusefable ask --quiet   # รับคำถามจาก stdin
cat bug.py | fusefable ask -q "ช่วยหาบั๊กในโค้ดนี้"
fusefable ask --json "..."                 # output JSON (answer, chosen_model, reason, cost, candidates)

--json เหมาะกับสคริปต์/agent ที่ parse ผลต่อ; --quiet เหมาะกับต่อ pipe

3) ใช้เป็น MCP server (Cursor / VS Code / Claude / agent อื่น)

รันเป็น MCP server ผ่าน stdio:

fusefable mcp

มี tool ชื่อ fuse_ask(question, models?, cheap?) ให้ client เรียก

Cursor

~/.cursor/mcp.json (หรือ Settings → MCP):

{
  "mcpServers": {
    "fusefable": {
      "command": "fusefable",
      "args": ["mcp"],
      "env": { "OPENROUTER_API_KEY": "sk-..." }
    }
  }
}

VS Code (Copilot / MCP-compatible extension)

.vscode/mcp.json ในโปรเจกต์:

{
  "servers": {
    "fusefable": {
      "command": "fusefable",
      "args": ["mcp"],
      "env": { "OPENROUTER_API_KEY": "sk-..." }
    }
  }
}

Claude Desktop

claude_desktop_config.json:

{
  "mcpServers": {
    "fusefable": {
      "command": "fusefable",
      "args": ["mcp"],
      "env": { "OPENROUTER_API_KEY": "sk-..." }
    }
  }
}

ต้องติดตั้ง pip install "fusefable[mcp]" และรัน fusefable config ไว้ก่อน ถ้า fusefable ไม่อยู่ใน PATH ของแอป ให้ใส่ path เต็ม เช่น python -m fusefable.cli

ทำงานยังไง

  1. fan-out — ยิงทุกโมเดลพร้อมกันด้วย asyncio (เวลารวม = ตัวช้าสุด)
  2. ตัวไหน timeout/พัง → ตัดทิ้ง ไม่ลากระบบช้า
  3. judge — ปกปิดชื่อโมเดล (Answer A/B/C...) แล้วให้โมเดล judge เลือกตัวดีสุด
  4. คืนคำตอบที่ดีที่สุด + ประมาณค่าใช้จ่าย

พัฒนา

pip install -e ".[dev,mcp]"
pytest -q

License

MIT

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

fusefable-0.1.0.tar.gz (19.0 kB view details)

Uploaded Source

Built Distribution

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

fusefable-0.1.0-py3-none-any.whl (16.8 kB view details)

Uploaded Python 3

File details

Details for the file fusefable-0.1.0.tar.gz.

File metadata

  • Download URL: fusefable-0.1.0.tar.gz
  • Upload date:
  • Size: 19.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for fusefable-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a8d2139aebe6c72ef4bc6879e6644087d31e0d1fc51cf9d8947a0434e6eca474
MD5 fa260119c782bdafc2851045e8c53986
BLAKE2b-256 af7e3ac7aa56295bf83c77a91336a28d7f18ef550ace360003e419db3675263a

See more details on using hashes here.

File details

Details for the file fusefable-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: fusefable-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 16.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for fusefable-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ea90eb28a7f700b854e8f7372a3974478be13c35462469a53dba7f381f26186c
MD5 d1c51f8aafa03ca2e80b61a8d6a2550b
BLAKE2b-256 858666c58d2e32945552f70a1e8a83382cbde467adcf3da9d416259287effe1c

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