Self-hosted alternatives to OpenAI API

Last updated · 6 options

Quick answer: llama.cpp has the most stars on its repository of the 6 options here (★ 132k), followed by vLLM (★ 94.1k). Stars show popularity, not fit, so check formats, platforms and licence for your own work.

OpenAI's paid API for GPT models, used by apps and developers. Here are 6 self-hosted options, most-starred first.

llama.cpp

Generative Artificial Intelligence (GenAI)

Fast C/C++ engine that runs open AI models on ordinary CPUs and GPUs, with a built-in chat page and OpenAI-style API

Stars
★ 132k
Licence
MIT
Updated
  • Docker

Alternative to ChatGPT, OpenAI API

vLLM

Generative Artificial Intelligence (GenAI)

High-throughput server for running open language models on GPUs behind an OpenAI-compatible API

Stars
★ 94.1k
Licence
Apache-2.0
Updated
  • Docker

Alternative to OpenAI API

LiteLLM

Generative Artificial Intelligence (GenAI)

Self-hosted AI gateway that puts 100+ model providers behind one OpenAI-style API

Stars
★ 61.6k
Licence
MIT
Updated
  • Docker

Alternative to OpenAI API

SGLang

Generative Artificial Intelligence (GenAI)

Fast GPU serving framework for large language and vision models

Stars
★ 37.4k
Licence
Apache-2.0
Updated
  • Docker

Alternative to OpenAI API

Speaches

Generative Artificial Intelligence (GenAI)

OpenAI-compatible speech server for transcription and text-to-speech

Stars
★ 3.7k
Licence
MIT
Updated
  • Docker

Alternative to OpenAI API, ElevenLabs

RamaLama

Generative Artificial Intelligence (GenAI)

Runs AI models in Podman or Docker containers with one command

Stars
★ 3.1k
Licence
MIT
Updated
  • Docker

Alternative to OpenAI API

FAQ

Is there a self-hosted alternative to OpenAI API?

Yes. SelfHostAlts lists 6 options: llama.cpp, vLLM, LiteLLM, SGLang, Speaches and RamaLama.

Which OpenAI API alternatives are open source?

llama.cpp (MIT), vLLM (Apache-2.0), LiteLLM (MIT), SGLang (Apache-2.0), Speaches (MIT) and RamaLama (MIT).

Which OpenAI API alternatives can run with Docker?

llama.cpp, vLLM, LiteLLM, SGLang, Speaches and RamaLama (all of them).

Related categories: Generative Artificial Intelligence (GenAI)

Self-hosted apps are rarely drop-in replacements. Check the import options, mobile apps and requirements before you move your data, and keep backups.

SelfHostAlts Weekly

Every week: the best new self-hosted alternatives to the SaaS tools you pay for, with what you need to run them. Free. More about it →