What is LiteLLM? Proxy, Gateway and Setup
Published Updated
LiteLLM is an open-source Python library and proxy server that lets applications call models from different providers through one OpenAI-compatible application programming interface (API). Use the library inside a single Python app. Run the proxy as a shared service when several apps or teams need the same access and spending controls.
What LiteLLM is
The LiteLLM library translates a Python app’s model request into the provider’s format and returns the result in the OpenAI format. For example, an app can use the same call to send a request to OpenAI or Anthropic. LiteLLM lists supported providers and endpoints because the available features depend on the provider and model. The shared request format leaves you with a smaller code change when switching models, but you still need to test the new model on your app’s work.
The LiteLLM Proxy does the translation on a server. Apps in any language can send requests to that server and keep using the same address when the platform team changes the provider behind a model name. The team can also add or revoke an app’s access centrally. LiteLLM’s repository uses the MIT licence for the open-source code and a separate licence for the enterprise directory.
What the LiteLLM Proxy Does
The proxy issues virtual keys to apps. A virtual key is an access credential for the proxy, so the app can make a request while the model provider’s credentials stay on the server. Give each app its own key and assign it to a team. You can then restrict which models the app can call, set a spending budget for the key or team and cap requests or tokens per minute. Separate keys let you revoke one app’s access without interrupting the other apps on that team.
Load balancing spreads calls across the deployments configured for a model name. A fallback sends a failed call to a configured backup model group after retries. For example, the proxy can spread document summaries across two deployments. If those deployments cannot serve a request, it can send it to an approved model from another provider. Test the fallback on representative documents and confirm that the backup is approved to process the same data.
LiteLLM can send request traces to an observability tool through OpenTelemetry. Decide whether those traces should contain prompt text or only operational details such as duration and error status. LiteLLM calculates estimated spend from reported usage and the rates in its model cost map. For a token-priced model, it applies separate rates to input and output tokens. Reconcile that estimate against invoices before using it for AI spend management, especially when you have negotiated rates or a deployment that needs custom pricing.
LiteLLM Compared With OpenRouter and Hosted Gateways
Self-hosting LiteLLM gives your team control over where the gateway runs and how it routes traffic. OpenRouter runs the gateway for you and gives you one endpoint for many models.
| What to compare | Self-hosted LiteLLM | OpenRouter or another hosted gateway |
|---|---|---|
| Where requests go | Requests pass through your infrastructure and then go to the model endpoint you configure. | Requests pass through the hosted service before reaching a model provider. Available regions depend on the service and route. |
| Work for your team | Run the gateway and its database. Own on-call support and upgrades. | Integrate the API and manage access. The vendor runs the gateway. |
| Routing and logs | Choose the endpoints, fallback rules and where to send logs. | Choose from the routing and logging settings the vendor makes available. |
A platform team whose policy requires gateway logs in its own Australian cloud account could run LiteLLM there and restrict traffic to approved model endpoints. A small team testing models on synthetic data could use OpenRouter to try several providers without setting up a gateway and database. OpenRouter publishes how it handles request data, including where retention can occur. Compare that with your provider’s terms when choosing an AI gateway.
Running LiteLLM in Production
Host the proxy in your organisation’s cloud account and choose an Australian region when local hosting is required. Put its PostgreSQL database and backups in an approved region too. Store provider credentials and the database connection secret in your cloud’s secret store, then inject them at deploy time. Check the model endpoint, any fallback endpoint and the logging destination separately. Those choices determine where request content goes, even when the proxy is in Australia.
Pin the proxy to a specific release. Read LiteLLM’s release notes and security advisories for the version you run and the version you plan to deploy. Rehearse database migrations in staging and test authentication, spending limits and failover with test traffic. Check that a request appears under the expected team and shows the correct usage before rolling the upgrade out.
LiteLLM allows single sign-on (SSO) for up to five Admin UI users without a paid licence. A larger SSO rollout and features such as audit logs and model-specific budgets on individual virtual keys require LiteLLM Enterprise.
Assign the proxy to a named platform team or contracted operator after launch. That owner applies patches, rotates credentials, handles outages and checks that backups can be restored. Before moving a second app onto the proxy, have the owner run a failover test and verify that the backup model stays within the same data policy.
Related reading
AI Gateways and LLM Routers Explained
An AI gateway sits between your apps and AI models to route requests, cap spend and log every call. Compare LLM gateways and see when you need one.
What is OpenRouter? Models, Pricing and Risks
OpenRouter gives one API key and one bill for hundreds of AI models. See how its pricing, free models and routing work before business use.
AI Spend Management: How to Control AI Costs
When AI costs sit across seats, API keys and expense claims, no one sees the total. Find every cost, set budgets and caps and route work to cheaper models.
AI Observability: Tracing, Evaluation and Costs
How do you know your AI assistant or agent works once it is live? Learn what AI observability tracks, from traces and quality scores to cost and drift.
embeddings
Embeddings is an Australian AI consultancy. We design, build and run AI systems inside the software, documents and data organisations already use, from offices in Perth and Melbourne.
About Embeddings