selfhost.directory

The index of self-hostable projects — ranked, categorized and served with live updates.
Own your data and stop giving it to big tech.

GPT-Load logo

Self-host GPT-Load

v2.0.0-rc.63

AI gateway for API keys and subscription accounts

BetaOpen SourceMIT
Docker ComposeCompose file & guide
docker compose up -d
Updatedyesterday
LanguageGo
Setup difficultyEasy
Stars
7 204
Ports
3001 (HTTP service (API gateway and embedded management UI)), 1455 (OAuth callback port for subscription channels), 54545 (OAuth callback port for subscription channels), 51121 (OAuth callback port for subscription channels)
Docker
ghcr.io/tbphp/gpt-load
Groups list showing channels, connection types, model counts and credential healthMonitor health page with available, cooling and blacklisted credentialsManagement console login with the generated management key

What is GPT-Load?

Should you self-host GPT-Load?

GPT-Load scores 66/100 on selfhost.directory (how scoring works) and ranks #7 of 39 in API Gateway. It has 7 204 GitHub stars, +26 in the last 30 days.

It shipped 2 stable releases in the past year. The latest, v1.4.14, came out on 27 October 2026. New versions land roughly every 5 days.

Setup is easy: most people get it running in one sitting. An official Docker image is available. It is MIT-licensed and written mostly in Go.

Its closest alternative on selfhost.directory is Kong Gateway (82/100, 44 370 stars). It scores higher overall, so compare the two before you pick. See GPT-Load vs Kong Gateway side by side.

Features

  • AccessKey management
  • Automatic failover and retries
  • Codex live voice relay
  • Credential blacklisting and recoverySubscription credentials need reauthorization or manual handling instead of probing.
  • Credential encryption at restLosing encryption.key makes stored credentials unrecoverable; no master-key rotation.
  • Embedded management web UI
  • Management API
  • Model aliases
  • Multi-credential load balancing
  • Multi-protocol AI gateway
  • Outbound proxy support
  • Request logging
  • Route check diagnostics
  • Subscription account channels
  • Usage and cost analyticsCosts are estimates derived from upstream usage, not provider invoices.

GPT-Load README

GPT-Load

GPT-Load

A self-hosted AI gateway for multi-channel, multi-credential setups

API keys, subscription accounts, traffic scheduling, failure handling, request logs, and usage accounting — behind a single entry point.

English · 中文 · 日本語 | Official Website

Release Docker Go License

tbphp/gpt-load | Trendshift Featured|HelloGitHub


Sponsors

Become a sponsor

Sponsor details (collapsible)

Modelflare

Thanks to Modelflare for sponsoring this project! Modelflare: Full strength, stable, nothing watered down. Global SOTA models at a lower cost. Operated by US-based Havenbyte LLC, Modelflare supports GPT, Claude, Gemini, Grok, and other leading models through common compatible protocols, plus 40+ image and video models.

Cache compensation is a highlight: selected OpenAI groups (price-first, stable, and premium) guarantee daily cache hit rates of 65%, 75%, or 85%, and if eligible requests fall short, Modelflare refunds the difference, visible on the usage dashboard after settlement.

Special offers: a single top-up of US$20 unlocks the GPT discount group at a 0.015x price multiplier, and a single top-up of US$50 unlocks the Claude discount group at a 0.03x multiplier. Register via this exclusive link to get started.


OfoxAI OfoxAI: Text, image, and video AI in one platform
OfoxAI is a unified AI API platform bringing together text, image, and video models from multiple providers. With OpenAI-compatible endpoints and native Anthropic and Gemini interfaces, developers can access models for AI applications, agents, and content creation through one platform. Explore OfoxAI models and APIs →
PackyCode PackyCode
Access leading AI models through PackyCode with one API endpoint and one API key. Enjoy fast, reliable access with automatic failover and dedicated high-speed routes for Codex and Claude Code. Get started with $1 in free credits, a discount on your first top-up, and savings of up to 80% on eligible routes. Pay in RMB with no currency conversion markups or extra top-up fees. Sign up through the link and start building today.
AxisNow Protect and accelerate websites and APIs, serving users in mainland China and around the world, and extend acceleration and security capabilities to native/mobile apps through a client SDK — self-built private-deployment CDN | subscription-based high-protection CDN | an independently controllable, flexibly composable CDN network.
APIMart Thanks to APIMart for sponsoring this project! APIMart is a low-cost API platform for AI image & video generation — GPT-Image-2 from $0.006/image, 160+ images per dollar. One async API covers both image and video: submit a task, get an ID, fetch results via polling or callback. Batch tens of thousands of images without timeouts, switch models without changing code. Pay-as-you-go with no monthly fee — sign up here to get started.

How to install GPT-Load

Install GPT-Load with Docker Compose

Docker and Docker Compose
Environment variables
HOST, PORT, AUTH_KEY, ENCRYPTION_KEY, DATA_DIR, DATABASE_DSN, BIND_ADDRESS, OAUTH_CALLBACK_BIND_ADDRESS
git clone --depth 1 https://github.com/tbphp/gpt-load.git
cd gpt-load

cp .env.example .env
docker compose up -d

Official Compose file uses ghcr.io/tbphp/gpt-load:2; data lives in the gpt-load-data volume. Recommended method.

How to configure GPT-Load

  • HOST127.0.0.1Native listening address, and the default host address for Compose's main port and OAuth callback ports; Compose always listens on `0.0.0.0` inside the container.
  • PORT3001HTTP service port, must be `1–65535`; Compose also uses it for the container port, host publishing, and health check.
  • BIND_ADDRESSEmpty, inherits HOSTCompose only; overrides the host publishing address for the main service port without changing OAuth callback ports.
  • OAUTH_CALLBACK_BIND_ADDRESSEmpty, inherits HOSTCompose only; overrides the host publishing address for the fixed OAuth callback ports `1455`, `54545`, and `51121`.
  • GRACEFUL_SHUTDOWN_TIMEOUT10Maximum time to wait for requests after a stop signal, positive integer in seconds.

GPT-Load releases & version history

@ Every self-hosted release, weekly

One Monday email with the week's stable releases across the directory.

FAQ

Why did the account switch while quota was still available?

Displayed quota does not drive rotation order — upstream rate-limit responses put an account into cooldown immediately, though refreshing quota can release eligible cooldowns early.

Why does a subscription account ask for reauthorization?

Start with the Refresh credentials action on the account card, and reconnect or re-import the account if that still fails; refreshing quota does not bring authorization back.

Why can't a remote deployment complete OAuth authorization?

The browser resolves localhost to your own machine, so the redirect never reaches the server; paste the full callback URL back into the console or forward the port over SSH.

Why does streaming output disconnect midway?

Raise the stream idle timeout, and make sure a fronting reverse proxy does not buffer responses — Nginx for example needs proxy_buffering off.

Why do inference models always time out?

Reasoning-heavy models can think for a long time before producing output, so raise the first-byte timeout rather than the overall request timeout.

What happens when a credential gets blacklisted?

Blacklisting kicks in after a configurable run of consecutive failures; API-key groups are probed periodically and restored on a successful probe, while subscription credentials must be reauthorized or handled manually.

Why do occasional failures recover on retry?

That pattern is normally upstream rate limiting: only the throttled model cools down on that credential while its other models stay available, and adding credentials is the simplest mitigation.

How can a client use a different model name?

Define a model alias so the name the client asks for is forwarded as a different upstream model, letting you change providers without touching application code.

Why does the gateway say a model does not exist?

Use route inspection to find out whether the AccessKey, the Group or the credential is responsible, adjust the configuration, and run the check again.

Can I access the gateway remotely?

Loopback-only binding is deliberate; reach the console over SSH forwarding or a hardened reverse proxy instead of switching to 0.0.0.0, because an exposed UI leaks every stored credential.

Why do I get an unauthorized / 401 response?

Requests must carry a gateway AccessKey; the management key and upstream provider keys serve different purposes.

What should I check when a client cannot connect?

Probe the service with a /health request first; if that succeeds the problem is client-side, usually an extra or missing /v1 suffix on the URL.

Why does startup report a permission error?

The managed data directory must be owner-only; when ownership or link type cannot be verified the program refuses to start rather than loosening the checks, so inspect the DATA_DIR owner.

Why doesn't changing HOST take effect inside the container?

Inside the container HOST and DATA_DIR are pinned, and published host reachability is decided by Compose port mapping, where BIND_ADDRESS wins over HOST.

What if the port is already occupied?

Port 3001 is the default and can be moved with PORT in .env, but the subscription callback ports 1455, 54545 and 51121 are fixed upstream, so only one default Compose instance per host can do local callback authorization.

More in API Gateway

Rate this project

Click to rate — no account needed.

0 comments

Posting as guest
Loading comments…