Run a Local OpenAI-Compatible API Server for Any App
Serve local models through an OpenAI-compatible API with Ollama, LM Studio, llama-server or KoboldCpp, and connect chat apps, coding tools and scripts.
An OpenAI-compatible API turns your local model into a drop-in replacement for hosted chat in thousands of apps.
Pick a server
| Runner | Start | Base URL |
|---|---|---|
| Ollama | Runs in the background | http://localhost:11434/v1 |
| LM Studio | Developer tab, start server | http://localhost:1234/v1 |
| llama-server | llama-server -m model.gguf | http://localhost:8080/v1 |
| KoboldCpp | Launch with a model | http://localhost:5001/v1 |
Test it
curl http://localhost:11434/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{"model":"qwen3:8b","messages":[{"role":"user","content":"Hello"}]}'
Connect apps
In any app with “OpenAI-compatible” or “custom endpoint” settings:
- Set the base URL from the table.
- Enter any API key.
- Choose the model name the server lists.
This works for Open WebUI, SillyTavern, coding assistants and the official OpenAI SDKs.
Settings that matter
Set context length on the server side; see the context length calculator. System prompts can be sent per request; draft one with the uncensored system prompt builder.
Security
Keep servers on localhost. See local LLM privacy.
Choosing a runner
Common questions
What base URL do I use for Ollama?
http://localhost:11434/v1 for the OpenAI-compatible API.
Do I need an API key?
Local servers usually ignore it, but many apps require a value, so enter any placeholder text.
Can I use it from another device?
Yes, by binding to your network address. Only do this on a trusted network and add authentication or a reverse proxy.
Related reading
Running Uncensored Models on a Mac with Apple Silicon
GuideLocal LLM Privacy: What Stays on Your Machine and What Doesn't
GuideHow to Run an Uncensored LLM Locally: A Beginner's Guide
ComparisonJan vs LM Studio: Open-Source or Polished Local AI Desktop App?
Free toolContext Length Calculator
Browse more: all guides · comparisons · glossary · free tools