Skip to content
Courses/Local MLOps and model deployment/Hybrid local/cloud routing with LiteLLM

Hybrid local/cloud routing with LiteLLM

The goal is not to use local for everything. The goal is to use local for routine, private, or low-cost work, and scale to an external model only when the use case justifies it and it is logged.

  • Design model groups by task, cost, and sensitivity.
  • Use fallbacks without hiding important errors.
  • Log when a task moved from local to cloud.
Terminal
model_list:
  - model_name: local-fast
    litellm_params:
      model: ollama/qwen2.5:7b
      api_base: http://localhost:11434

  - model_name: local-gpu
    litellm_params:
      model: openai/Qwen/Qwen2.5-14B-Instruct
      api_base: http://localhost:8000/v1
      api_key: none

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

Practical policy

  • Local-fast: drafts, classification, summaries of non-sensitive documents.
  • Local-gpu: long tasks, internal RAG, and agents with more context.
  • Frontier-review: final review, difficult reasoning, or repeated local failure.
Terminal
routing_rules:
  sensitive_data: local_only
  max_local_retries: 2
  allow_cloud_fallback:
    - public_code_review
    - generic_planning
    - final_quality_check
  require_human_approval:
    - customer_data
    - legal_docs
    - financial_docs

Official sources

  • LiteLLM Docs
  • LiteLLM routing and load balancing
  • LiteLLM fallbacks
  • Ollama API
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