Free, open-source alternatives to OpenAI API

Paid API for OpenAI's language models. 2 apps you can run yourself instead of OpenAI API, sorted by how well they replace it. Each one is open source, so your data stays with you.

  1. OllamaBest match

    Get up and running with Llama 3.3, DeepSeek-R1, Phi-4, Gemma 3, and other large language models.

    183k starsMITUpdated 13 October 2026
  2. LocalAI

    Run your AI models locally and generate images and audio (alternative to OpenAI and Claude).

    49.5k starsMITUpdated 12 October 2026

Side by side

AppStarsLicenseActivityRuns on
Ollama182,934MITDocker, Python
LocalAI49,498MITDocker, Kubernetes

Why replace OpenAI API?

OpenAI API works, but your data lives in someone else's account, the price can change at any time, and features can disappear. An open-source app you run yourself is yours: you choose where it runs, who can see the data, and when to update.

Questions

What is the best free alternative to OpenAI API?

Ollama is the closest open-source replacement for OpenAI API in our list. LocalAI are worth a look too, depending on what you need.

Can I self-host an alternative to OpenAI API?

Yes. All 2 apps on this page are open source and can run on your own server, usually with Docker, or on a managed host that installs them for you.