{
 "schema_version": 1,
 "generated": "2026-10-26",
 "id": "mudler-localai--self-host-an-openai-compatible-api",
 "repo": "mudler/LocalAI",
 "repo_url": "https://github.com/mudler/LocalAI",
 "repo_slug": "mudler-localai",
 "title": "Self-host an OpenAI-compatible API on your own server",
 "page_title": "How to self-host an OpenAI-compatible API on your own server with LocalAI",
 "summary": "Run LocalAI in Docker, load a model and point your existing OpenAI client code at it.",
 "who": "A developer or small team that wants to stop sending prompts and data to a cloud API.",
 "problem": "Cloud AI APIs cost money per call and your data leaves your infrastructure.",
 "outcome": "A local endpoint on port 8080 that existing OpenAI or Anthropic clients can call, running on CPU or GPU.",
 "steps": [
  "Start the CPU image: `docker run -ti --name local-ai -p 8080:8080 localai/localai:latest`",
  "Or with an NVIDIA GPU: `docker run -ti --name local-ai -p 8080:8080 --gpus all localai/localai:latest-gpu-nvidia-cuda-12`",
  "Load a model, for example `local-ai run llama-3.2-1b-instruct:q4_k_m`",
  "Point your app's OpenAI base URL at http://localhost:8080",
  "Restart later with `docker start -i local-ai`"
 ],
 "agent_prompt": "Set up mudler/LocalAI in Docker on this machine (GPU image if an NVIDIA GPU is present, CPU image otherwise), load a small instruct model, and change <app>'s OpenAI client to use it. Run one test request and report latency.",
 "agents": [
  "claude-code",
  "codex",
  "cursor"
 ],
 "difficulty": "Beginner",
 "time": "30 minutes",
 "basis": "readme",
 "caveat": "",
 "category": "Software and DevOps",
 "tags": [
  "Software and DevOps"
 ],
 "lang": "go",
 "requirements": [
  "Docker or Podman, or the macOS app (not signed by Apple)",
  "Optional GPU: NVIDIA, AMD, Intel, Apple Silicon or Vulkan; CPU-only works",
  "Disk space for the models you pull"
 ],
 "risk": "none",
 "seen_in_the_wild": false,
 "mentioned_publicly": false,
 "risks": [],
 "best": true,
 "score": 1.0,
 "evidence": [],
 "url": "https://dedupedai.com/use-cases/mudler-localai/self-host-an-openai-compatible-api/",
 "md": "https://dedupedai.com/use-cases/mudler-localai/self-host-an-openai-compatible-api/index.md",
 "disclaimer": "Deduped lists open-source repositories that belong to other people. We do not own, maintain, audit, or vouch for any of them, and a repo appearing here is not an endorsement or a safety check. The use cases, steps, and prompts are written by AI and may be incomplete, outdated, or just wrong. Where a use case is marked \"Seen in the wild\", we link to public posts where someone described something similar, but we have not verified those posts and the use case itself is still our AI's own write-up. Use all of this at your own risk. Only run code, commands, or agents on systems and accounts you are authorized to use, and read the code and every command before you run it, especially anything that touches credentials, files, or the network. Nothing here is professional, security, legal, or financial advice. All trademarks and project names belong to their respective owners, and their use here does not imply affiliation. Content is provided as is, without warranties of any kind. Found a mistake, a safety problem, or something you want removed? Email hello@dedupedai.com and we will look at it promptly.",
 "api": "https://dedupedai.com/api/v1/usecases/mudler-localai--self-host-an-openai-compatible-api.json",
 "api_version": "v1"
}
