Self-hosting one-api / new-api vs. a Managed AI Gateway: Cost, Ops & Security

Comparison · 2026-11-20 · ~10 min read

"Should we run our own one-api?" is a question almost every team doing multi-model access eventually faces. Online answers are polarized: the open-source camp says "it's half an hour of work", the managed camp says "self-hosting is digging your own pit". Both have a point, and both skip the crucial context. This article gives you an honest decision framework. We operate a managed gateway ourselves (4-4 AI, built on the new-api ecosystem), so we will flag the judgments that favor us — adjust for that bias with your own data.

First, three concepts

Essentially, self-hosting vs. managed is not about features. It is about who owns operational responsibility and failure risk.

Dimension 1: cost model — the hidden cost list of self-hosting

The explicit cost of self-hosting is simple: one server plus a database. The real difference is in the hidden parts:

Cost itemSelf-hostedManaged
Server + databasemonthly fee, plus backup storagenone (included in the service fee)
Version upgrades & security patchesyou perform every upgrade; you fix every failureplatform responsibility, invisible to users
Channel maintenanceupstream changes an endpoint — you update channel configsplatform maintains channel health
Incident responseit breaks at 3 a.m., you crawl out of bedSLA / platform on-call
Backups & restore drillsyou must build it — and actually rehearse itplatform duty
Security hardeningexposed databases, weak passwords, unauthorized access — all on youplatform baseline

A practical way to estimate:

Self-host monthly cost ≈ server fees
          + maintenance hours per month × your hourly rate
          + expected loss of one major incident (downtime × business loss)

Once items two and three are written down explicitly, most small teams flip their conclusion — at low usage, the "free" self-hosted setup is actually more expensive. Conversely, if you have dedicated ops staff, very high volume, and strict data-sovereignty requirements, the self-hosting math can work.

Bias notice: this section favors the managed side (us). If you genuinely have ops capacity and have benchmarked your own setup, trust your measurements over our framing.

Dimension 2: operations — what you actually sign up for

Most tutorials stop at "docker run and you're done". Long-term operation of a new-api instance at least involves:

  1. Data layer: backup strategy for MySQL/SQLite, disk-water monitoring. One server reinstall without backups — channel configs, tokens, user data all gone. This incident pattern shows up constantly in community forums;
  2. Process supervision: register a systemd service or use container orchestration so the service survives reboots. A bare nohup deployment disappears the first time the server restarts;
  3. Security baseline: never expose the database to the public internet, change every default password, configure and renew HTTPS certificates, rotate logs;
  4. Upgrade cadence: upstream updates are frequent; schema-changing upgrades require a backup-first procedure;
  5. Observability: usage stats, anomaly alerts, per-channel success-rate monitoring — all self-assembled.

On a managed platform, none of these five items exist for you. The price is accepting the platform's rules and pricing.

Dimension 3: security — the biggest gap in responsibility

Self-hosted gateway incidents follow highly repetitive patterns:

A managed platform turns these into platform responsibility. If you self-host, do at least these four: bind the database to 127.0.0.1, change every default password, enable HTTPS, export database backups off-box regularly. Those four block the vast majority of incidents.

Dimension 4: decision matrix — pick by your stage

Your situationRecommendation
Personal project / small team, no dedicated opsManaged gateway. Hidden costs dwarf the service fee; time-to-market wins
Mid-size team, stable growthStart managed; revisit self-hosting only when gateway fees become a significant line item
Ops team + high volume + data-sovereignty needsSelf-hosting is reasonable. Base it on new-api, then complete the ops checklist above
Reselling API access as a businessHarder call: self-hosting gives control but heavy duty; choose managed only after confirming multi-tenant billing / prepaid-card support

There is also a middle path: validate the business on a managed gateway first, keep your engineering hours on the core product, and migrate to self-hosting once volume justifies it. Gateways are OpenAI-compatible — migration is one Base URL switch.

FAQ

one-api or new-api — which to self-host?

Most of the fork ecosystem (including our own codebase) has moved to new-api; channel adapters are more active there. But the choice doesn't change the core fact: you own all the ops.

Is self-hosting really cheaper?

Run the formula above — don't count only server fees. Maintenance hours and expected incident loss are usually the bigger terms. The higher your volume and ops maturity, the better self-hosting gets.

Is a managed gateway slower?

Same-datacenter-class forwarding latency is milliseconds on both paths; the bottleneck is almost always the upstream model, not the gateway. When choosing, care more about channel stability and failover than about latency marketing.

How hard is migrating from self-hosted to managed?

Business-side, swap the Base URL from your self-hosted domain to the managed one and change the key. The protocol is fully compatible — no business code changes.

Related articles

7 Engineering Practices to Cut Token Costs in AI Applications From model tiering and context trimming to prefix caching and budget guards: 7 practical, code-level engineeri 4-4 AI Quickstart: Connect to a Unified AI API in 5 Minutes Step-by-step: register on 4-4 AI, create an API key, and use the OpenAI-compatible Base URL to reach GLM, Deep
Ready to build?

One key for GLM, DeepSeek, Qwen and more — unified billing and usage analytics.

View models & pricing Get started