Self-hosted service
cita-777/metapi avatar
cita-777/metapi

cita-777/metapi: one API key in front of your New API and One API sites

Aggregates sites you've registered elsewhere (New API, One API, OneHub, DoneHub, Veloera, AnyRouter, Sub2API, etc.) into a single API key and single entry point, with automatic model discovery, smart routing and cost optimization.

3,332 stars533 forksTypeScriptMIT

At a glance

What is it?
Metapi is a TypeScript meta-aggregation layer that pools New API, One API, OneHub, DoneHub, Veloera, AnyRouter and Sub2API upstreams behind a single proxy endpoint. The pitch is model discovery, cost-aware routing and failover; the catch is that every credential you own ends up in one database.
Who is it for?
Adopt Metapi if you already run several New API style upstreams and want one endpoint for Cursor, Claude Code or Open WebUI, and you are willing to set ACCOUNT_CREDENTIAL_SECRET and AUTH_TOKEN to real random values before the first upstream is added. Skip it if you have a single upstream, or if you cannot accept that one database holds the credentials for every account you register.
Can I use it commercially?
Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository last received commits 10 days ago.
What is it written in?
Mainly TypeScript, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on November 25, 2026, and from our analysis. They are not legal advice.

From daily snapshots

Star history

  • cita-777/metapi3,332 ★ · +41
Star history
Repository2026-09-242026-11-25
cita-777/metapi3.3k3.3k

41 Stars in the last 62 days, measured from the daily GitHub snapshot. Compare with other projects

Editorial analysis

The problem Metapi solves, and who has it

Anyone who signs up for several New API or One API style relay sites ends up with the same mess. Each site issues its own key, exposes its own model list, and holds its own balance. Downstream tools such as Cursor, Claude Code, Codex or Open WebUI each want a base URL and a key, so the number of credentials you paste into editors grows with the number of sites you joined. The README describes Metapi as a meta-aggregation layer sitting above those sites: you register the upstreams once, and Metapi publishes a single proxy entry point that downstream tools point at. The README also notes that more than one downstream API key can be configured per project, so the single entry does not have to mean a single shared secret. The intended user is not someone with one upstream. It is someone with a portfolio of them, who wants the model list, the balances and the failover logic handled in one place.

How the aggregation layer routes a request

The mechanism is a proxy in front of the upstream APIs. Metapi stores site configurations and account credentials, discovers the models each upstream offers, and exposes them under a unified /v1/* path that speaks the OpenAI style API. When a request arrives, the routing layer picks a channel using cost, remaining balance and usage, and if a channel fails it is cooled down and the next one is tried. That is the failover behaviour the README advertises in its pain-point table. Two scheduled jobs run alongside the proxy: a check-in cron for sites that award quota daily, and a balance refresh cron that keeps the dashboard current. Model discovery is automatic, so a model added upstream appears in the aggregated list without a manual edit. The repository is a Fastify and TypeScript application, with separate build targets for the server, the web UI and an Electron desktop shell, and Drizzle present as the database layer. The README does not document the exact scoring formula behind cost-aware routing, only that cost, balance and usage are inputs.

Installing Metapi and adding a first upstream

The README points to a Docker image at 1467078763/metapi, and the repository also ships a render.yaml and a zeabur-template.yaml for one-click deploys. A local run needs Node.js, and the .env.example asks for a random secret before anything else. Copy the example file and replace both placeholder values; AUTH_TOKEN is the admin token you will log in with, and ACCOUNT_CREDENTIAL_SECRET is the key material protecting stored upstream credentials. The README warns explicitly not to reuse AUTH_TOKEN as that secret.

bash
cp .env.example .env
# edit .env: set AUTH_TOKEN and ACCOUNT_CREDENTIAL_SECRET to long random values
npm install
npm run dev

The dev script starts the server and the Vite front end together. The default port in .env.example is 4000, and the desktop dev script waits on tcp:127.0.0.1:4000, which confirms that is where the server listens. After the process is up, open the web UI, log in with the AUTH_TOKEN you set, and add a site under site management: base URL plus credentials. Once the site is saved, the model list should populate from the upstream. The check-in and balance jobs are controlled by cron expressions in the same file, defaulting to 0 8 * * * and 0 * * * *.

bash
# the two scheduled jobs, as shipped in .env.example
CHECKIN_CRON=0 8 * * *
BALANCE_REFRESH_CRON=0 * * * *

For a production install, the README links a deployment guide rather than inlining the steps, so the exact Docker invocation and volume layout should be read there. The repository does contain a docker/ directory and an update-and-restart.sh script, which suggests the maintainers expect self-hosted upgrades to be scripted rather than manual.

Where the design bites: credentials, probes and upstream limits

The central trade-off is concentration. Metapi exists to hold the credentials for every upstream account you register, and the .env.example treats ACCOUNT_CREDENTIAL_SECRET as production-critical, which tells you the maintainers know what is at stake. A single compromise of the Metapi host or its database exposes the whole portfolio, not one site. The README's own public demo carries a warning not to enter real API keys, accounts or site information, and notes the demo data may be wiped at any time. That is a reasonable precaution, and it also shows the project is not designed to be exposed carelessly. The model availability probe is off by default (MODEL_AVAILABILITY_PROBE_ENABLED=false) with a concurrency of 1 and a 30 minute interval, which is conservative: turning it on against many upstreams will generate real traffic and may trip rate limits. Failover is only as good as the upstreams behind it. If every site you registered resells the same upstream capacity, a cooldown cascade does not give you availability, it just moves the failure. And if you have exactly one upstream, Metapi adds a database, a scheduler and a proxy to a problem you do not have.

Metapi compared with LiteLLM and a plain New API deployment

The closest thing in the same space is LiteLLM, which also presents an OpenAI compatible proxy with routing and fallbacks. The difference in approach is what sits underneath. LiteLLM is built around provider SDKs and model names, so you configure OpenAI, Anthropic, Bedrock and similar providers directly. Metapi is built around relay panels: its upstream types are New API, One API, OneHub, DoneHub, Veloera, AnyRouter and Sub2API, plus generic OpenAI, Claude and Gemini compatible endpoints and named presets for Alibaba Cloud, Zhipu, Doubao Coding Plan, DeepSeek, Moonshot, MiniMax, ModelScope, OrcaRouter and Infistar. It also manages OAuth connections for Codex, Claude, Gemini CLI and Antigravity, which is a workflow LiteLLM does not centre on. If your providers are the official APIs, LiteLLM is the more direct fit. If your providers are relay sites you signed up for individually, Metapi is modelling your actual situation. Running a single New API instance yourself is the third option, and it is simpler, but it does not aggregate sites you do not control.

Maintenance, upgrades and the MIT licence

The repository is not archived and the last push was on 2026-09-06, which is recent enough that the project is being worked on, though the most recent tagged release is v1.3.0 from 2026-04-06. That gap between the last push and the last release means main may contain changes that are not in a tagged version, so pinning to a release tag is the safer default for a production deployment. The package.json declares engines.node as >=25.0.0 while the README badge advertises Node.js 22.15+, and those two statements do not agree. Check which one your host satisfies before building from source; a Docker image sidesteps the question. Upgrades are made easier by the presence of update-and-restart.sh and a docker/ directory, but the README does not document rollback, so snapshot the data directory before upgrading. The licence is MIT, which permits commercial use and modification with the copyright notice retained. That is a statement about the licence text, not legal advice; if you redistribute Metapi or run it as a paid service, read the LICENSE file and the SECURITY.md in the repository yourself.

Editorial conclusion

Adopt Metapi if you already run several New API style upstreams and want one endpoint for Cursor, Claude Code or Open WebUI, and you are willing to set ACCOUNT_CREDENTIAL_SECRET and AUTH_TOKEN to real random values before the first upstream is added. Skip it if you have a single upstream, or if you cannot accept that one database holds the credentials for every account you register. Before going live, verify the Node.js version your host actually provides, confirm the official preset list covers your providers, and check whether the Docker tag you pull matches the 1.3.0 release.

Frequently asked questions

What is a meta API, and is that what Metapi is?

Metapi is not an API in the sense of a hosted service you call. It is a self-hosted proxy that aggregates several New API style upstream sites behind one endpoint, so downstream tools see a single base URL and key.

Which upstream sites can Metapi aggregate?

The README lists New API, One API, OneHub, DoneHub, Veloera, AnyRouter and Sub2API, plus generic OpenAI, Claude and Gemini compatible endpoints, named provider presets, and OAuth connections for Codex, Claude, Gemini CLI and Antigravity.

How do I install Metapi and start it locally?

The README points to a Docker image at 1467078763/metapi and the repository ships render.yaml and zeabur-template.yaml for hosted deploys. For a local run, copy .env.example to .env, set AUTH_TOKEN and ACCOUNT_CREDENTIAL_SECRET to random values, then run npm install and npm run dev, which serves on port 4000 by default.

Does Metapi switch to another site automatically when one fails?

Yes. The README describes automatic failover where a failing channel is cooled down and the next one is selected, and the routing layer chooses among channels using cost, balance and usage.

Is it safe to try Metapi on the public demo site?

No. The README warns that the demo is a public environment and tells users not to enter API keys, account passwords or site information, and notes the data may be cleared at any time.

Official sources

  1. cita-777/metapi on GitHub
  2. License: MIT
  3. Project website
  4. README
  5. Releases
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/cita-777-metapi.svg)](https://hysenlabs.com/projects/cita-777-metapi)

Star history chart for your README

markdown
[![Star history](https://hysenlabs.com/chart/cita-777-metapi.svg)](https://hysenlabs.com/projects/cita-777-metapi)

Was this useful?