Skip to content

LiteLLM as a gateway

LiteLLM lets you place one API in front of local models and external providers, with virtual keys, budgets, rate limits, and fallbacks.

Mental model

Your application should not need to know whether it calls Ollama, vLLM, OpenAI, Anthropic, or a fallback. It talks to the gateway; the gateway applies policy.

Terminal
model_list:
  - model_name: local-fast
    litellm_params:
      model: ollama/qwen3:4b
      api_base: http://localhost:11434

  - model_name: frontier-review
    litellm_params:
      model: openai/gpt-4.1-mini
      api_key: os.environ/OPENAI_API_KEY

router_settings:
  num_retries: 2
  fallbacks:
    - { local-fast: [frontier-review] }

What to control from the gateway

  • Virtual keys per environment, user, or team.
  • Budgets and rate limits to avoid surprises.
  • Fallbacks by model, tag, or task type.
  • Cost, latency, and error logs.

Official sources

  • LiteLLM Routing & Load Balancing: https://docs.litellm.ai/docs/routing-load-balancing
  • LiteLLM Virtual Keys: https://docs.litellm.ai/docs/proxy/virtual_keys
  • LiteLLM Budgets and Rate Limits: https://docs.litellm.ai/docs/proxy/users
Complete Aulafy mapSee how this lesson fits without leaving your path.

Complete Aulafy map

How all courses connect

This is not a checklist. Start with the foundation, choose an outcome, and go deeper only when your project needs more control.

  1. 1Understand
  2. 2Apply or build
  3. 3Operate with confidence
01

Choose an application

Turn the foundation into a visible outcome: a website, a business improvement, media, or an interactive experience.

Continue into the technical branch when you need to maintain code, data, or infrastructure.

02

Build with code

Prepare your environment, work with coding agents, and run models while keeping control of your projects.

This branch prepares you to design and operate reliable AI systems.

03

Take systems to production

Combine retrieval, agents, evaluation, security, deployment, and model adaptation when the problem requires it.

You do not need every course: choose the component your system needs and return as it grows.

View full catalogue