Procurement & Architecture · Updated October 2026

Self-hosted versus managed AI gateways: the real operating-cost decision

A free open-source gateway and a paid managed gateway are not the same purchase. One transfers more infrastructure responsibility to your team; the other introduces a vendor dependency and subscription. The useful comparison is total cost and operational control for your specific workload.

Practical engineering guidance. Verify provider-specific capabilities, pricing, and support before deployment.

Key takeaways

  • Open-source licensing cost is not equivalent to production operating cost.
  • Managed subscriptions must be justified by measurable reliability, governance or labor savings—not vague token-reduction promises.
  • Self-hosting a gateway does not mean upstream model requests remain in your own network.
  • Run a restore drill and an exit drill before choosing either architecture.

Define the architecture before comparing price tags

Self-hosted generally means your team runs the gateway application and its supporting services. A managed gateway runs its control or data plane under the vendor's operations, although some vendors offer hybrid or customer-environment deployments. A model marketplace can additionally act as the inference billing intermediary. These categories overlap; ask which exact component is operated by whom and which legal entity invoices provider tokens.

LiteLLM's production deployment documentation describes a proxy, PostgreSQL for keys and spend records, Redis for shared rate-limit and routing state in multi-instance setups, secret management and load balancing. That is a real service architecture, not simply a free executable. A managed gateway may eliminate some of those duties for the buyer but does not eliminate integration testing, upstream quotas, provider invoices or the need for application-side access controls.

  • Draw the full request path, including credential custody and provider endpoint.
  • Identify who patches, monitors, backs up and restores each component.
  • Separate managed data plane, managed control plane and marketplace billing.

Use a total-cost worksheet with no invented savings

Compute monthly total as upstream inference plus gateway fees plus infrastructure plus engineering operations plus observability and retention plus amortized migration work. For self-hosting, include compute, database, Redis, backups, TLS, network egress, upgrades and on-call response. For managed services, include subscription, metered requests or logs, contractual support and any BYOK or credit-purchase fees. If a marketplace resells inference, do not count the same provider charge twice.

Consider an illustrative internal planning case, not a vendor benchmark: a self-hosted stack costing $120 per month in infrastructure and six staff hours at an assumed fully loaded $60/hour costs $480 monthly before upstream inference and incident risk. A managed service priced at $249.99 monthly would be cheaper on those assumptions, but the result reverses if the team already operates the infrastructure and needs only one hour of upkeep. Replace every illustrative input with your actual quotes and observed labor.

  • Compare identical traffic volumes, model mix and log retention.
  • Show assumptions and sensitivity ranges rather than a single precise-looking number.
  • Track cost per quality-accepted task, not merely price per million tokens.

What public vendor documentation actually establishes

Cloudflare's AI Gateway pricing documentation states that core analytics, caching and rate limiting are free, while logs and other features follow their own terms. It also describes a fee for Unified Billing credit purchases. That does not make every workload free: upstream inference, paid log retention and other services still matter. Its documented rate limits differ for Unified Billing and BYOK, so the chosen billing path affects capacity as well as cost.

LiteLLM's production guidance recommends shared Redis once multiple proxy instances are running and describes PostgreSQL-backed key and usage features. Portkey documents managed routing and fallback behavior; alternative provider attempts can change total inference cost. AetherGate's publicly listed Team plan has been $249.99 per month with BYOK provider inference billed separately. Treat all prices as dated observations and verify current contracts and production features before making a decision.

  • Use the official pricing page, not a comparison blog's stale screenshot.
  • Verify which capabilities require enterprise licensing or additional services.
  • Ask for an itemized example bill at your expected traffic volume.

Reliability is an ownership question

With self-hosting, your team owns deployment upgrades, schema migrations, database recovery, shared counters, incident response and security patching. You can control the environment and investigate deeply, but the gateway becomes another production system with its own failure modes. With managed hosting, the vendor may take on much of the platform operation, yet your application still needs circuit breakers, direct-provider rollback and visibility into upstream incidents.

Ask who can roll back a bad configuration, how long historical traces remain available, what happens when a region fails, and whether the gateway can continue forwarding requests when its management database is unavailable. Run an outage rehearsal: disable a non-production dependency, inspect errors, restore from backup and measure recovery time. A product's marketing uptime percentage is not evidence that your particular workload will meet its SLO.

  • Define recovery time and data-loss objectives for policies, keys and usage.
  • Test upgrade rollback and disaster recovery with synthetic traffic.
  • Check whether provider outages are distinguishable from gateway outages.

Security control versus security responsibility

Self-hosting can keep gateway runtime and credential storage inside your chosen environment, but the application may still decrypt upstream provider keys to send authorized requests. A managed BYOK service likewise needs a documented method for using provider credentials. Encryption at rest does not establish that a compromised application runtime cannot access plaintext keys. Require a threat model that identifies key creation, decryption, rotation, revocation and administrator access.

Compare prompt and response logging defaults, data residency, audit exports, deletion controls, incident notification terms and independent evidence for claimed security certifications. A private deployment is not automatically compliant, and a vendor's enterprise label is not a certification. Test least privilege with a low-scope application key, and verify that it cannot change its own spending policy or read another tenant's records.

  • Require evidence for deployed controls, not only architectural diagrams.
  • Separate upstream provider retention from gateway log retention.
  • Document who responds to a suspected provider-key exposure.

Run a two-week decision trial and an exit rehearsal

Choose two real but permissioned workloads: one latency-sensitive request stream and one batch or agent workflow. Compare direct-provider calls, a self-hosted gateway and a managed candidate using the same models, input distribution and quality rubric. Measure p50/p95 latency, failures, successful-task cost, time spent operating the gateway and time to investigate a deliberately injected error. Include all retries and cached-token classes in cost reconciliation.

Then practice leaving each option. Export policies and usage, revoke the gateway-facing credential, restore the direct-provider path and verify that production-like traffic still works. For a small team with limited operations capacity, a paid managed service may be rational even if its subscription is higher than a free license. For a mature platform team with existing infrastructure, self-hosting may be the better control and cost choice. Neither outcome should be asserted before the trial.

Sources

Evaluate the gateway on your own workload

Compare an actual gateway request with your direct-provider baseline. Review pricing, security controls and measured behavior before migrating production traffic.

Gateway evaluation resources

Continue from the concept to a practical cost, security or migration decision.

Continue reading

Related gateway comparisons

Frequently asked questions

Is a self-hosted AI gateway free?

The software license may be free, but production hosting, databases, monitoring, upgrades, security and staff time still have costs.

Does BYOK remove gateway fees?

No. BYOK identifies ownership of the upstream provider account; gateway subscriptions, request charges or logging fees may still apply.

When is a managed gateway worth paying for?

When measured operational, reliability or governance benefits exceed the subscription and integration cost for your workload, after accounting for vendor dependence and exit risk.

Put the advice into practice

Optimize AI work with Foreman

Give the team a job. Foreman weighs the work, model capabilities and price, then explains its choices. Enable web tools for public research. Review, edit or decline proposed actions before they run.

Give Foreman a job →
Technical details

Reasoning-model task routing, persisted specialist/reviewer workflows, web search, Chromium browsing and approval-gated browser/HTTP writes. Fresh public sessions; no signed-in accounts or arbitrary code execution.

Set a limit before the work starts

Per-key spending controls. Each request reserves its estimated cost before it's sent, and parallel calls are only admitted while those reservations fit under the cap.

Set spending controls →
Technical details

Atomic catalog-priced cost reservations, per-key caps, and retained reservations for uncertain charges. Provider invoices, taxes and special rates can differ.