One API and New API are popular open-source AI API gateway projects. They consolidate multiple model providers behind a single OpenAI-compatible interface. As usage grows, many teams start asking whether to build their own gateway or use a managed service.

This article explains the difference, what self-hosting requires, when it makes sense, and how to migrate.

Note: One API and New API are the names of their respective projects and rights holders. This article is for technical discussion only. For specific features and licensing, refer to the project repositories.

1. What One API and New API are

Both are, in essence, API gateways:

Your app → gateway (keys / quotas / routing / logs) → OpenAI / Claude / Gemini / DeepSeek

Common capabilities include:

  • An OpenAI-compatible interface.
  • Multi-channel and multi-model management.
  • Users, tokens, quotas, and groups.
  • Usage logs and billing.
  • Rate limiting, retries, and channel failover.
  • An admin dashboard.

One API appeared earlier; New API is one of the projects that continued to evolve in its ecosystem, with a more modern feature set and admin interface. Both are suitable for teams with some technical capability to self-host.

2. What self-hosting requires

1. A server

A Linux server that can run Docker. The specs depend on concurrency and log volume. A small team does not need a powerful machine to start, but bandwidth and disk space matter.

2. A database

Common choices are SQLite for simplicity, MySQL, or PostgreSQL. For production, prefer MySQL or PostgreSQL and set up reliable backups.

Used for caching, sessions, rate limiting, and similar tasks. It becomes more important in multi-node deployments.

4. A domain and HTTPS

You need a domain, DNS, a reverse proxy such as Caddy or Nginx, and certificates. Payment callbacks and OAuth login both require public HTTPS.

5. Upstream accounts and channels

You must supply your own upstream keys or channels for OpenAI, Claude, Gemini, DeepSeek, and others. The gateway itself does not provide model quota.

6. Operations

This includes upgrades, backups, monitoring, logs, security patches, payment reconciliation, and alerting. These are the main hidden costs of self-hosting.

3. Self-hosted vs managed

Dimension Self-hosted One API/New API Managed service (such as ZSQH)
Initial cost Server, domain, and time Sign up and use
Data control High; data stays on your server Depends on the provider's terms
Model channels You apply for and maintain them Provided by the platform
Operations Your responsibility The platform's responsibility
Upgrades and security You keep up The platform keeps up
Payment and invoicing You handle them The platform handles them
Customization High Limited by platform features
Best for Teams with engineers and deep customization needs Teams that want to launch quickly with less operations work

4. General self-hosting steps

1. Prepare the server and domain

Install Docker, point the domain, and configure the firewall. Expose only ports 22, 80, and 443; do not expose the database or Redis to the public internet.

2. Deploy the database and Redis

Use strong random passwords, configure persistent volumes, and take daily backups.

3. Deploy the gateway

Start the application, database, and Redis with Docker Compose. Configure environment variables for:

  • The database connection.
  • The Redis connection.
  • The session secret.
  • The site address.
  • CORS and trusted domains.

4. Configure the reverse proxy and HTTPS

Proxy Caddy or Nginx to the application port and enable HTTPS and HSTS.

5. Configure upstream channels

Add channels, models, groups, and multipliers in the admin dashboard. Validate with a small test key first.

6. Configure payment and OAuth (optional)

Payment callbacks and Google or GitHub login require public HTTPS and correct callback URLs.

7. Monitoring and backups

At minimum, set up availability monitoring, error logs, database backups, and disk alerts.

5. When self-hosting makes sense

  • You have an engineering team that can handle servers and upgrades.
  • Data must remain on your own servers.
  • You need deep customization of routing, billing, or permissions.
  • Upstream channels are stable and you can maintain them yourself.
  • Usage is high enough that managed fees clearly exceed the total cost of self-hosting.

6. When self-hosting does not make sense

  • You have no operations staff.
  • You only want to launch and validate a product quickly.
  • You cannot sort out upstream accounts, payment, or compliance.
  • You cannot guarantee security updates and backups.
  • Your main goal is to save a little on API fees.

Self-hosting is not free. Servers, domains, certificates, backups, monitoring, troubleshooting, and security updates all cost money.

7. Migrating to a managed service

If you already self-host but want to move to a managed service:

  1. Export user, token, and channel configurations for inventory only. Do not expose keys.
  2. Create an account and keys on the managed platform.
  3. Change the Base URL to the managed address.
  4. Map your model names.
  5. Run a small traffic canary for 3–7 days.
  6. Keep the self-hosted instance as a backup, and decommission it only after the new service is stable.

8. FAQ

Is New API better than One API?

It depends on your requirements, versions, and maintenance capacity. Look at project activity, documentation, licensing, community, and your technology stack, not just a feature list.

Can a self-hosted gateway call official models directly?

Yes, but you must provide the upstream keys or channels yourself and comply with each provider's terms.

How much does self-hosting cost?

Servers, domains, backups, monitoring, and labor all count. Small deployments can be cheap, but enterprise-grade high availability, backups, and security require real investment.

Does a managed service lock me in?

That depends on whether you keep the Base URL and model names in configuration. If you stay OpenAI-compatible and configuration-driven, migration costs drop significantly.

Next steps

If you do not want to maintain servers, databases, payment, and upgrades, start with the managed ZSQH AI Gateway and get your business running; if self-hosting is mandatory, use the checklist above to assess labor and security costs. Model names and prices are listed under Model Pricing.

Further reading: