{
 "kind": "api",
 "slug": "litellm",
 "path": "apis/litellm/",
 "name": "LiteLLM",
 "logo": "https://agentgid.com/media/avatars/berriai.png",
 "maker": "BerriAI",
 "density": "full",
 "crumbs": [
  [
   "APIs",
   "apis/"
  ],
  [
   "LLM gateways and routers",
   "apis/llm-gateway/"
  ]
 ],
 "lead": "One way to call 100+ AI model providers.",
 "chips": [
  {
   "label": "LLM gateways and routers",
   "path": "apis/llm-gateway/"
  }
 ],
 "primary": {
  "label": "Copy prompt for your agent",
  "copy": "Add LiteLLM to my Python app: pin litellm==1.108.3, read provider keys from .env, call completion() with provider-prefixed model names like \"openai/...\", add a backup model with Router fallbacks, and catch litellm.RateLimitError and AuthenticationError."
 },
 "links": [
  {
   "label": "Website",
   "href": "https://www.litellm.ai"
  },
  {
   "label": "Pricing",
   "href": "https://www.litellm.ai/enterprise"
  },
  {
   "label": "GitHub",
   "href": "https://github.com/BerriAI/litellm"
  }
 ],
 "track": "Outages, price changes and new versions on your dashboard",
 "verdicts": [
  {
   "key": "price",
   "label": "Price",
   "value": "Open source",
   "status": "yes",
   "sub": "Run it yourself for free",
   "quote": null,
   "note": "Free tier: Open-source gateway free to self-host. As reported on the official pricing page, checked Nov 9, 2026.",
   "src": "https://www.litellm.ai/enterprise"
  },
  {
   "key": "commercial",
   "label": "Commercial use",
   "value": "Allowed",
   "status": "yes",
   "sub": null,
   "quote": "Content outside of the above mentioned directories or restrictions above is available under the MIT license as defined below.",
   "note": "MIT for everything outside the enterprise/ folder; Enterprise features need a paid license key.",
   "src": "https://github.com/BerriAI/litellm/blob/main/LICENSE"
  },
  {
   "key": "key",
   "label": "Key & sign-up",
   "value": "API key, server only",
   "status": "info",
   "sub": "Env var OPENAI_API_KEY, ANTHROPIC_API_KEY and other provider variables (library); LITELLM_MASTER_KEY and LITELLM_SALT_KEY (gateway)",
   "quote": null,
   "note": "Library: each provider's own key from environment variables. Gateway: a virtual key (or the master key) sent as \"Authorization: Bearer sk-...\" No LiteLLM account is needed for the open-source library or gateway; the AI providers you call may require a card.",
   "src": "https://docs.litellm.ai/docs/proxy/docker_quick_start"
  },
  {
   "key": "agent",
   "label": "Agent access",
   "value": "Docs for agents",
   "status": "info",
   "sub": "llms.txt · OpenAPI · SDK",
   "quote": null,
   "note": " Our agent check: 5 of 6 (Nov 13, 2026).",
   "src": "https://www.litellm.ai/llms.txt"
  }
 ],
 "vfoot": "Checked against the maker's official pages, pricing on Nov 9, 2026.",
 "blocks": [
  {
   "id": "overview",
   "nav": "Overview",
   "h2": "What LiteLLM does",
   "parts": [
    {
     "t": "prose",
     "text": "LiteLLM is free open-source software, not a service you sign up for. It lets your app talk to many AI model providers, such as OpenAI, Anthropic or Gemini, in one common format, so you can switch models without rewriting code. You use it as a Python library inside your app, or run its gateway server so several apps and teammates share keys, budgets and spend tracking. Each model provider still bills you for its calls."
    },
    {
     "t": "list",
     "items": [
      "LiteLLM is one of 8 APIs in the LLM gateways and routers category on AgentGid.",
      "It is one of 7 that can be started for free.",
      "4 of them ship an official MCP server; LiteLLM does not.",
      "Its official SDK is the 2nd most downloaded in the category (26.5M a week)."
     ],
     "muted": true
    },
    {
     "t": "h3",
     "text": "What people build with it"
    },
    {
     "t": "uses",
     "items": [
      {
       "title": "Switch AI models without rewrites",
       "text": "Try a cheaper or newer model by changing one model name, while your other code and the reply format stay the same.",
       "idea": false
      },
      {
       "title": "Backup model when a provider fails",
       "text": "If one AI provider is down or slow, the request goes to a second model you named, so users still get an answer.",
       "idea": false
      },
      {
       "title": "Shared AI access for a team",
       "text": "Run one gateway for your company so each app or teammate gets its own key with a budget and a spending limit, instead of sharing the real provider keys.",
       "idea": false
      },
      {
       "title": "See what each AI request costs",
       "text": "Log the price of every model call, so you can see which feature or customer spends the most.",
       "idea": false
      },
      {
       "title": "Coding assistants on any model",
       "text": "Point Claude Code, Codex or Cursor at your own gateway, so their requests use the models and budgets your team picked.",
       "idea": false
      },
      {
       "title": "Free test runs for AI features",
       "text": "In automated tests, return a fixed fake answer instead of calling a paid model, so tests are free and repeatable.",
       "idea": false
      }
     ]
    }
   ]
  },
  {
   "id": "popularity",
   "nav": "Popularity",
   "h2": "LiteLLM popularity",
   "parts": [
    {
     "t": "stats",
     "items": [
      {
       "n": "23.6M",
       "l": "SDK downloads a week",
       "d": "+1.0% on the 4-week average",
       "up": true
      },
      {
       "n": "761",
       "l": "public agent repos use its SDK"
      },
      {
       "n": "63.7K",
       "l": "GitHub stars, BerriAI/litellm"
      }
     ]
    },
    {
     "t": "small",
     "text": "SDK downloads from npm and PyPI, weekly. Numbers as of Nov 17, 2026."
    }
   ]
  },
  {
   "id": "pricing",
   "nav": "Pricing and limits",
   "h2": "Pricing",
   "parts": [
    {
     "t": "rows",
     "rows": [
      {
       "l": "Free tier",
       "v": "Open-source gateway free to self-host"
      },
      {
       "l": "Cheapest plan",
       "v": "No monthly plan"
      },
      {
       "l": "Usage price",
       "v": "—"
      },
      {
       "l": "Plans",
       "v": "Enterprise (SSO/SCIM, audit logs, air-gapped, 24/7 SLA support) is custom-priced via sales; 30-day trial key available. No vendor-run MCP server; LiteLLM can itself act as an MCP gateway."
      }
     ]
    },
    {
     "t": "more",
     "items": [
      {
       "title": "Price history",
       "items": [
        "1 change in our catalog since Oct 9, 2026, last on Oct 9, 2026."
       ]
      }
     ]
    },
    {
     "t": "small",
     "text": "As reported on the official pricing page, checked Nov 9, 2026. Prices change: confirm before you buy.",
     "link": "litellm.ai/enterprise",
     "href": "https://www.litellm.ai/enterprise"
    }
   ]
  },
  {
   "id": "access",
   "nav": "Access and terms",
   "h2": "Key and access",
   "parts": [
    {
     "t": "rows",
     "rows": [
      {
       "l": "How it signs in",
       "v": "Library: each provider's own key from environment variables. Gateway: a virtual key (or the master key) sent as \"Authorization: Bearer sk-...\""
      },
      {
       "l": "Environment variable",
       "v": "OPENAI_API_KEY, ANTHROPIC_API_KEY and other provider variables (library); LITELLM_MASTER_KEY and LITELLM_SALT_KEY (gateway)",
       "code": true
      },
      {
       "l": "Safe in browser code",
       "v": "No, keep it on your server",
       "status": "no"
      },
      {
       "l": "Card at sign-up",
       "v": "No"
      }
     ]
    },
    {
     "t": "h3",
     "text": "Steps only a person can do"
    },
    {
     "t": "list",
     "items": [
      "Create an account and an API key with each AI provider you plan to use (for example OpenAI or Anthropic), and add billing there. Put the keys in .env as OPENAI_API_KEY, ANTHROPIC_API_KEY and so on; LiteLLM reads them from the environment.",
      "For the gateway, install Docker (or Podman) on the machine that will run it and decide who may reach port 4000. Generate LITELLM_MASTER_KEY and LITELLM_SALT_KEY into .env, start the compose file and create virtual keys for each app.",
      "Only if the team needs single sign-on for more than 5 users, audit logs or an SLA, request an Enterprise trial key. Set the license key on the same gateway; no code change."
     ]
    }
   ]
  },
  {
   "id": "terms",
   "nav": null,
   "spy_as": "access",
   "h2": "Commercial use and your data",
   "parts": [
    {
     "t": "prose",
     "text": "The code is MIT-licensed, so you may use it for free in paid products and change it; keep the license notice. Files in its enterprise folder are under a separate license, and some team features need a paid Enterprise license."
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "In a paid app",
       "v": "Yes",
       "status": "yes",
       "sub": "MIT for everything outside the enterprise/ folder; Enterprise features need a paid license key.",
       "quote": "Content outside of the above mentioned directories or restrictions above is available under the MIT license as defined below.",
       "src": "https://github.com/BerriAI/litellm/blob/main/LICENSE"
      },
      {
       "l": "inside-app-bundle",
       "v": "With conditions",
       "status": "cond",
       "sub": "You may ship it inside your product; include the MIT copyright and permission notice.",
       "quote": "The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.",
       "src": "https://github.com/BerriAI/litellm/blob/main/LICENSE"
      },
      {
       "l": "redistribute-files",
       "v": "With conditions",
       "status": "cond",
       "sub": "Allowed under MIT with the notice kept; files under enterprise/ follow enterprise/LICENSE instead.",
       "quote": "All content that resides under the \"enterprise/\" directory of this repository, if that directory exists, is licensed under the license defined in \"enterprise/LICENSE\".",
       "src": "https://github.com/BerriAI/litellm/blob/main/LICENSE"
      },
      {
       "l": "client-work",
       "v": "Yes",
       "status": "yes",
       "sub": "MIT allows use for clients; the clients need their own provider keys and accounts.",
       "quote": "to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software",
       "src": "https://github.com/BerriAI/litellm/blob/main/LICENSE"
      },
      {
       "l": "Keeps your data",
       "v": "Self-hosted gateways keep data in your own database; LiteLLM servers store nothing unless you send telemetry to them.",
       "quote": "No data or telemetry is stored on LiteLLM Servers when you self-host",
       "src": "https://docs.litellm.ai/docs/data_security"
      },
      {
       "l": "Where data is stored",
       "v": "Wherever you run it; Enterprise is also self-hosted in your own cloud.",
       "quote": "It runs in your cloud, so prompts and responses never leave your environment.",
       "src": "https://docs.litellm.ai/docs/enterprise"
      }
     ]
    }
   ]
  },
  {
   "id": "errors",
   "nav": null,
   "spy_as": "access",
   "h2": "Errors to handle",
   "parts": [
    {
     "t": "rows",
     "rows": [
      {
       "l": "401 AuthenticationError",
       "v": "The provider (or gateway) rejected the key.",
       "sub": "Check the provider key in .env or the virtual key; do not retry."
      },
      {
       "l": "402 PaymentRequiredError",
       "v": "The provider account is out of credits.",
       "sub": "Top up the provider account, or let the Router fall back to another deployment."
      },
      {
       "l": "429 RateLimitError",
       "v": "The provider (or a gateway key limit) is rate limiting you.",
       "sub": "Retry with backoff, or configure fallbacks to another deployment."
      },
      {
       "l": "400 ContextWindowExceededError",
       "v": "The prompt is too long for the chosen model.",
       "sub": "Shorten or trim the messages, or set a context window fallback to a model with a larger window."
      },
      {
       "l": "BudgetExceededError",
       "v": "The gateway key, user or team has used up its budget.",
       "sub": "Raise the budget in the Admin UI or wait for the budget period to reset; do not retry."
      }
     ]
    }
   ]
  },
  {
   "id": "agent",
   "nav": "For agents",
   "h2": "Use it from an agent",
   "parts": [
    {
     "t": "rows",
     "rows": [
      {
       "l": "Our agent check",
       "v": "5 of 6: llms.txt yes, OpenAPI yes, SDK yes, MCP no, status page yes, AI assistants allowed yes",
       "sub": "Checked Nov 13, 2026."
      },
      {
       "l": "MCP server",
       "v": "None found",
       "sub": null
      },
      {
       "l": "PyPI",
       "v": "pip install litellm",
       "code": true
      }
     ]
    },
    {
     "t": "h3",
     "text": "Instructions in its docs to check first"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "The docs say",
       "v": "“To have Claude Code set up the Gateway for you, install the LiteLLM setup skill and then type /litellm-setup in Claude Code”",
       "sub": "Ask the person first. The page's command (npx skills add BerriAI/litellm -g) installs a skill globally from the repository, and the skill installs the gateway, writes config and keys and starts it."
      },
      {
       "l": "The docs say",
       "v": "“Agents and CI: the script asks nothing when there is no terminal, under CI or Claude Code”",
       "sub": "The quickstart pipes a remote script from the main branch into sh and starts Docker services without questions. Ask the person first, read the script, and prefer the step-by-step compose quickstart with a pinned tag."
      }
     ]
    }
   ]
  },
  {
   "id": "alternatives",
   "nav": "Alternatives",
   "h2": "Alternatives",
   "parts": [
    {
     "t": "alts",
     "items": [
      {
       "name": "LiteLLM",
       "me": true,
       "facts": [
        "Free (open source)",
        "Free tier"
       ]
      },
      {
       "name": "OpenRouter",
       "why": "Pick OpenRouter when you want one hosted account and one OpenAI-compatible key for hundreds of models, with nothing to run yourself.",
       "path": "apis/openrouter/",
       "facts": [
        "Free plan",
        "Free tier",
        "Official MCP"
       ]
      },
      {
       "name": "Vercel AI Gateway",
       "why": "Pick Vercel AI Gateway when your app already runs on Vercel and you want a hosted gateway billed at provider list prices.",
       "path": "apis/vercel-ai-gateway/",
       "facts": [
        "Free plan",
        "Free tier"
       ]
      },
      {
       "name": "Prisma AIRS AI Gateway (formerly Portkey)",
       "why": "Pick Portkey when you want a hosted gateway with routing and fallbacks plus prompt management and observability in one product.",
       "path": "apis/portkey/",
       "facts": [
        "Free (open source)",
        "Free tier"
       ]
      }
     ],
     "more": "All llm gateways and routers APIs",
     "more_path": "apis/llm-gateway/"
    }
   ]
  },
  {
   "id": "start",
   "nav": "Get started",
   "h2": "Get started",
   "parts": [
    {
     "t": "prompt",
     "text": "Add LiteLLM to my Python app: pin litellm==1.108.3, read provider keys from .env, call completion() with provider-prefixed model names like \"openai/...\", add a backup model with Router fallbacks, and catch litellm.RateLimitError and AuthenticationError."
    },
    {
     "t": "steps",
     "items": [
      {
       "text": "Install the Python package (or pip install litellm), and put each provider key in an environment variable.",
       "code": "uv add litellm",
       "src": "https://github.com/BerriAI/litellm/blob/main/README.md"
      },
      {
       "text": "Make your first call (example from the official docs); the model name starts with the provider.",
       "code": "from litellm import completion\nimport os\n\nos.environ[\"OPENAI_API_KEY\"] = \"your-api-key\"\n\nresponse = completion(\n  model=\"openai/gpt-6.1-sol\",\n  messages=[{\"role\": \"user\", \"content\": \"Hello, how are you?\"}]\n)\nprint(response.choices[0].message.content)",
       "src": "https://docs.litellm.ai/docs/"
      },
      {
       "text": "For a shared gateway, start it with Docker Compose and a database (official quickstart), then open the Admin UI at http://localhost:4000/ui.",
       "code": "curl -sSLO https://github.com/BerriAI/litellm/raw/main/docker/docker-compose.quickstart.yml\nprintf 'LITELLM_MASTER_KEY=sk-%s\\nLITELLM_SALT_KEY=sk-%s\\n' \"$(openssl rand -hex 32)\" \"$(openssl rand -hex 32)\" > .env\ndocker compose -f docker-compose.quickstart.yml up -d",
       "src": "https://docs.litellm.ai/docs/proxy/docker_quick_start"
      }
     ]
    },
    {
     "t": "h3",
     "text": "First request"
    },
    {
     "t": "tabs",
     "label": "First request",
     "items": [
      {
       "tab": "Request",
       "code": "curl http://localhost:4000/v1/chat/completions \\\n  -H 'Authorization: Bearer sk-<your-virtual-key>' \\\n  -H 'Content-Type: application/json' \\\n  -d '{\n    \"model\": \"gpt-6.1-sol\",\n    \"messages\": [{\"role\": \"user\", \"content\": \"Say hello in five words.\"}]\n  }'",
       "intro": "A call to your own self-hosted gateway; the library form is the completion() example in start."
      },
      {
       "tab": "Response",
       "code": "{\n  \"id\": \"chatcmpl-DzGKiNRbQ4fe9Mgt8HSHFQ6ApfRJi\",\n  \"model\": \"gpt-6.1-sol\",\n  \"object\": \"chat.completion\",\n  \"choices\": [{\"finish_reason\": \"stop\", \"index\": 0,\n    \"message\": {\"content\": \"Hello, nice to meet you.\", \"role\": \"assistant\"}}],\n  \"usage\": {\"completion_tokens\": 70, \"prompt_tokens\": 12, \"total_tokens\": 82}\n}"
      }
     ]
    },
    {
     "t": "h3",
     "text": "Mistakes to avoid"
    },
    {
     "t": "mistakes",
     "items": [
      {
       "dont": "Running the gateway from a plain config file without a database and trusting max_budget to cap spending.",
       "fix": "Run the gateway with its Postgres database (the Docker Compose quickstart), or set spending limits at each provider.",
       "why": "Without a database the global budget check never fires and virtual keys do not work."
      },
      {
       "dont": "Regenerating LITELLM_SALT_KEY or losing the .env file after provider keys were added in the Admin UI.",
       "fix": "Keep the generated .env (out of git) and back it up together with the database.",
       "why": "The salt key encrypts stored provider keys and has no in-place rotation."
      },
      {
       "dont": "Deploying the image as docker.litellm.ai/berriai/litellm:latest and letting it update on every pull.",
       "fix": "Pin a specific release tag in the compose file and upgrade on purpose.",
       "why": "The docs suggest editing the compose file to pin a release; an unpinned tag changes under you."
      },
      {
       "dont": "Installing litellm and litellm-core in the same Python environment.",
       "fix": "Install one of them; use litellm when you need the gateway or command line, litellm-core for a lean library install.",
       "why": "The two packages contain the same Python files and overwrite each other."
      },
      {
       "dont": "Catching each provider's own exception classes (openai, anthropic) around litellm calls.",
       "fix": "Catch litellm.AuthenticationError, litellm.RateLimitError and the other mapped types once.",
       "why": "LiteLLM converts every provider's errors to the OpenAI exception types."
      }
     ]
    }
   ]
  },
  {
   "id": "faq",
   "nav": "Questions",
   "h2": "Questions",
   "parts": [
    {
     "t": "faq",
     "items": [
      {
       "q": "Is LiteLLM a paid service?",
       "a": "No. The library and the gateway are open source under MIT and you run them yourself. You pay the AI providers you call; an Enterprise license is optional.",
       "evidence": {
        "url": "https://docs.litellm.ai/docs/enterprise",
        "quote": "Enterprise is a license key on the same Gateway image you may already run."
       }
      },
      {
       "q": "Do I need to learn a new format for each provider?",
       "a": "No. Every reply comes back in the OpenAI Chat Completions format, whichever provider answered.",
       "evidence": {
        "url": "https://docs.litellm.ai/docs/",
        "quote": "Every response follows the OpenAI Chat Completions format, regardless of provider."
       }
      },
      {
       "q": "Can apps written in JavaScript or other languages use it?",
       "a": "Yes, through the gateway. It speaks the OpenAI format, so an app keeps its OpenAI client and only changes the base address and key.",
       "evidence": {
        "url": "https://docs.litellm.ai/docs/proxy/docker_quick_start",
        "quote": "The gateway is OpenAI-compatible, so any OpenAI SDK works by pointing it at http://localhost:4000 with your virtual key."
       }
      },
      {
       "q": "Does LiteLLM see my prompts?",
       "a": "Not when you self-host; the docs say no data or telemetry is stored on LiteLLM servers. Your prompts still go to the AI provider you call.",
       "evidence": {
        "url": "https://docs.litellm.ai/docs/data_security",
        "quote": "No data or telemetry is stored on LiteLLM Servers when you self-host"
       }
      }
     ]
    }
   ]
  }
 ],
 "glance": [
  [
   "Maker",
   "BerriAI"
  ],
  [
   "Category",
   "LLM gateways and routers"
  ],
  [
   "Price",
   "Free (open source)"
  ],
  [
   "Official SDK",
   "PyPI litellm"
  ],
  [
   "Latest SDK",
   "1.108.3 on npm"
  ],
  [
   "Agent check",
   "5 of 6"
  ],
  [
   "Pricing checked",
   "Nov 9, 2026"
  ]
 ],
 "good": [
  "LiteLLM itself is free, but you need your own account and key with each AI provider you call, and they bill you for usage.",
  "The gateway runs on your own computer or server; LiteLLM does not host it for you on a free plan.",
  "Budgets and per-key spending limits work only when the gateway has a database; without one, spending is not capped."
 ],
 "checked_line": "Read by AgentGid from 20 official pages, card checked Nov 10, 2026; usage numbers update daily."
}