The steps and settings come from LiteLLM's documentation and GitHub README, plus the Ollama and LM Studio API docs, all read on 2 December 2026.
Once you run more than one local AI server, every app needs to know which machine, port and model name to use. A desktop with an RTX card might run Ollama, a laptop might run LM Studio, and a second GPU box might run llama.cpp's llama-server. For servers that LiteLLM has no named prefix for, such as llama-server, its docs say to put openai/ in front of the model name and point api_base at the server's OpenAI-compatible endpoint. LiteLLM sits in front of all of them as one gateway. Its developers describe it as an open source AI gateway that lets you call over 100 LLM providers in the OpenAI format, and the same proxy works for servers on your own network.
The result is one address, by default port 4000 in LiteLLM's examples, and one list of model names that chat front ends, coding assistants and scripts can all use.
What you need
At least one local model server. Ollama exposes an OpenAI-compatible API at http://localhost:11434/v1/, and LM Studio's server uses http://localhost:1234/v1 in its examples. See our guides to using the LM Studio server and sharing Ollama on your local network if a server needs to be reachable from another PC.
Python 3.10 or newer, or the uv tool. LiteLLM's docs say version 1.84.0 and newer need Python 3.10 or higher, and that uv tool install sets up a compatible Python for you, whereas a plain pip install on an older Python quietly installs an older LiteLLM release.
A PC to run the proxy on. The proxy forwards requests rather than running the models itself, so the models' GPU needs apply to the machines running Ollama, LM Studio or llama.cpp, not the proxy PC. It can live on one of your GPU machines or a small always-on box.
Step 1: Install the LiteLLM proxy
LiteLLM's quick start installs the proxy with:
uv tool install 'litellm[proxy]'
Use the litellm[proxy] package rather than the plain Python SDK, because the README says the proxy, CLI and optional extras come with litellm.
Step 2: Write a config file
Create a file called config.yaml. Each entry under model_list maps a public model name, which your apps will ask for, to a real model on a real server. Here is an example with Ollama on the same PC and LM Studio on another machine:
model_list:
- model_name: qwen-chat
litellm_params:
model: ollama_chat/qwen3:14b
api_base: http://localhost:11434
- model_name: laptop-model
litellm_params:
model: lm_studio/your-loaded-model
api_base: http://192.168.1.50:1234/v1
Three details matter:
Use the ollama_chat/ prefix for Ollama chat models. LiteLLM's Ollama page recommends ollama_chat "for better responses" and says it sends requests to Ollama's /api/chat endpoint.
Use the lm_studio/ prefix for LM Studio. LiteLLM says it supports all LM Studio models with that prefix. You can also set the server address with the LM_STUDIO_API_BASE environment variable instead of api_base.
Change the model names to the ones you actually have. The model names and IP address in the example above are only examples. Use the tag shown by ollama list and the model identifier LM Studio shows for the model you have loaded.
LiteLLM's Ollama docs also show an optional keep_alive setting, such as "8m", that overrides Ollama's default for how long a model stays loaded in graphics memory.
Step 3: Start the proxy and test it
Start the proxy with:
litellm --config config.yaml
Add --detailed_debug if something doesn't work, as LiteLLM's docs suggest. Then send a test request from the same PC:
curl http://localhost:4000/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{"model": "qwen-chat", "messages": [{"role": "user", "content": "Hello"}]}'
If the reply comes back, any app that accepts a custom OpenAI base URL can now use http://<proxy-pc>:4000 and the model names from your config. That includes front ends such as Open WebUI and coding tools like Continue.
Step 4: Spread one model across two GPU PCs
This is where a gateway starts to help on the hardware side. If two PCs can run the same model, list both under the same model_name:
model_list:
- model_name: qwen-chat
litellm_params:
model: ollama_chat/qwen3:14b
api_base: http://192.168.1.20:11434
- model_name: qwen-chat
litellm_params:
model: ollama_chat/qwen3:14b
api_base: http://192.168.1.21:11434
router_settings:
routing_strategy: least-busy
LiteLLM's load-balancing docs say it automatically spreads requests across multiple deployments of the same model. The default strategy is simple-shuffle, which distributes requests at random. least-busy sends each request to the deployment with the fewest active requests, and latency-based-routing picks the fastest-responding one. For a household or small office sharing two GPU machines, least-busy is a sensible place to start.
This is not the same as splitting one large model across two PCs. Each request still runs entirely on one machine, so every PC needs enough VRAM for the whole model. If the model is too big for any single card, look at llama.cpp RPC or GPUStack instead.
Step 5: Add fallbacks and priorities
LiteLLM can also try another model when the first one fails. Its config docs show a fallbacks setting under litellm_settings, for example fallbacks: [{"qwen-chat": ["laptop-model"]}], plus num_retries and a request timeout. You can also set order on deployments: the docs say lower values have higher priority, and if an order: 1 deployment fails, the router tries order: 2 next. That suits a setup where your main GPU desktop should take every request, with a smaller machine as a backup when the desktop is off.
Step 6: Lock it down before you share it
If anything other than your own PC can reach port 4000, set a master key. LiteLLM's docs say you can set it under general_settings: master_key in the config or with the LITELLM_MASTER_KEY environment variable. Apps then send that key as their API key.
Per-person virtual keys, spend tracking and the Admin UI need more. The docs say virtual keys require a PostgreSQL database set through DATABASE_URL, and that the basic commands above start the proxy without a database. For a single home user, a master key is usually enough. Don't open the proxy to the internet. If you need remote access, use a private network such as Tailscale.
If all your models run on one PC and the problem is that they don't all fit in VRAM at once, LiteLLM won't solve it, because it doesn't start or stop model servers. llama-swap does that job, and our LiteLLM vs llama-swap comparison explains how the two fit together. For other gateway options, see our best LLM gateways for local AI.