{
 "schema_version": 1,
 "generated": "2026-11-09",
 "id": "lightning-ai-litgpt--serve-an-open-llm-as-a-local-http-api-with-litgpt",
 "repo": "Lightning-AI/litgpt",
 "repo_url": "https://github.com/Lightning-AI/litgpt",
 "repo_slug": "lightning-ai-litgpt",
 "title": "Serve an open LLM as a local HTTP API",
 "page_title": "How to serve an open LLM as a local HTTP API with Litgpt",
 "summary": "Start Litgpt serve on an off the shelf model and call its /predict endpoint from Python.",
 "who": "A developer who wants a private model endpoint for an internal tool.",
 "problem": "Hosted APIs send data off the machine and cost per call.",
 "outcome": "A model server on 127.0.0.1:8000 that answers prompts posted to /predict.",
 "steps": [
  "Install with `pip install 'litgpt[extra]'`",
  "List supported models with `litgpt download list`",
  "Start the server with `litgpt serve microsoft/phi-2`",
  "From a separate Python session, POST a JSON body with a prompt to http://127.0.0.1:8000/predict using requests",
  "Read the reply from the output field of the JSON response"
 ],
 "agent_prompt": "With Lightning-AI/litgpt, run `litgpt serve microsoft/phi-2`, then write a small Python script that posts {\"prompt\": \"Fix typos in the following sentence: Example input\"} to http://127.0.0.1:8000/predict and prints the output field.",
 "agents": [
  "claude-code",
  "codex",
  "cursor",
  "gemini-cli"
 ],
 "difficulty": "Beginner",
 "time": "20 minutes",
 "basis": "readme",
 "caveat": "The server listens on localhost only; add your own auth before exposing it.",
 "category": "Software and DevOps",
 "tags": [
  "Software and DevOps"
 ],
 "lang": "python",
 "requirements": [
  "Python with pip",
  "A GPU for finetuning and pretraining",
  "Disk space for model weights"
 ],
 "risk": "none",
 "seen_in_the_wild": false,
 "mentioned_publicly": false,
 "risks": [
  {
   "tag": "download",
   "notice": "Model weights download on first use."
  }
 ],
 "best": false,
 "score": 0.9,
 "evidence": [],
 "url": "https://dedupedai.com/use-cases/lightning-ai-litgpt/serve-an-open-llm-as-a-local-http-api-with-litgpt/",
 "md": "https://dedupedai.com/use-cases/lightning-ai-litgpt/serve-an-open-llm-as-a-local-http-api-with-litgpt/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/lightning-ai-litgpt--serve-an-open-llm-as-a-local-http-api-with-litgpt.json",
 "api_version": "v1"
}
