DEV Community

AgentHub
AgentHub

Posted on

I Built an Open-Source API Gateway for 100+ AI Models at $0.14/M Tokens

TL;DR

AgentHub is a unified, OpenAI-compatible API gateway for 100+ models (DeepSeek, Qwen, Claude, etc.) at $0.14/M tokens — about 99% cheaper than GPT-4.


Why I Built This

Most developers juggle multiple API keys, billing dashboards, and SDK quirks. AgentHub gives you one key, one endpoint, 100+ models.

Price Comparison

Provider Price / M tokens
GPT-4o ~$15.00
Claude 3.5 ~$15.00
OpenRouter ~$0.09–0.20
AgentHub $0.14 (all models)

Same interface. Switch models by changing one string.

Quick Start

from openai import OpenAI

client = OpenAI(
    api_key="YOUR_KEY",
    base_url="https://api.agenthub-wu.cn/v1",
)

resp = client.chat.completions.create(
    model="deepseek-chat",
    messages=[{"role": "user", "content": "Hello!"}],
)
print(resp.choices[0].message.content)
Enter fullscreen mode Exit fullscreen mode

Features

  • OpenAI-compatible API — drop-in for existing code
  • Auto failover — if one model is down, route to the next
  • Fully open source (MIT) — no black box
  • Payments: Alipay, WeChat, USDT
  • Mobile app — connect local AI (Ollama/LM Studio) from your phone

Who Is It For?

  • Indie hackers who want cheap inference at scale
  • Teams in regions where OpenAI billing is painful
  • Anyone who wants to experiment with Chinese + international models from one gateway

Links


Feedback and PRs welcome. Happy to answer questions in the comments.

Top comments (0)