# Local models (/platform/self-hosting/local-models)

Point Sim at a model server you run. Set these on the app, then recreate it; models appear in the model picker.

| Server | Variables | Models appear as |
| - | - | - |
| Ollama | `OLLAMA_URL` | `ollama/<model>` |
| vLLM or LM Studio | `VLLM_BASE_URL`, optional `VLLM_API_KEY` | `vllm/<model>` |
| LiteLLM | `LITELLM_BASE_URL`, optional `LITELLM_API_KEY` | Models the proxy serves |

`VLLM_BASE_URL` accepts the server root or its `/v1` URL. Knowledge bases can embed on Ollama too; see [Knowledge bases](/platform/self-hosting/environment-variables#knowledge-bases).

Warning:

Inside a container, `localhost` is the container itself. Use `host.docker.internal` for a server on the Docker host: the Compose files map it to the host on every platform.

## Ollama on the Docker host \[#ollama-on-the-docker-host]

Save the address in `.env` beside `docker-compose.prod.yml`, then recreate the app:

```bash
OLLAMA_URL=http://host.docker.internal:11434
```

Ollama must listen where the container reaches the host. On Linux, bind it to the Docker bridge address, usually `OLLAMA_HOST=172.17.0.1:11434` (check with `ip -4 addr show docker0`). Its API has no authentication, so bind `0.0.0.0` only behind a firewall that blocks port 11434 from outside the host.

## Ollama in the Compose stack \[#ollama-in-the-compose-stack]

`docker-compose.ollama.yml` adds an Ollama server to the production stack, reachable only inside the Compose network as `ollama:11434`. Add the address to `.env` first; the overlay refuses to start without it:

```bash
OLLAMA_URL=http://ollama:11434
```

Start the stack with one server profile, then pull the starter model, `gemma3:4b`:

```bash
# NVIDIA GPU (requires the NVIDIA Container Toolkit); use --profile cpu without a GPU
docker compose -f docker-compose.prod.yml -f docker-compose.ollama.yml --profile gpu up -d
docker compose -f docker-compose.prod.yml -f docker-compose.ollama.yml --profile setup run --rm model-setup
```

Pull other models inside the server's container, `ollama` for the GPU profile or `ollama-cpu` for the CPU profile:

```bash
docker compose -f docker-compose.prod.yml -f docker-compose.ollama.yml --profile gpu exec ollama ollama pull llama3.2
```

Set `COMPOSE_FILE=docker-compose.prod.yml:docker-compose.ollama.yml` and `COMPOSE_PROFILES=gpu` (or `cpu`) in `.env` so plain `docker compose` commands and `npx sim-setup update` include Ollama.

## Ollama on Kubernetes \[#ollama-on-kubernetes]

Set `ollama.enabled: true` in the Helm values to deploy Ollama in the release; the chart points `OLLAMA_URL` at it. `ollama.gpu.enabled: true` adds GPU scheduling and the NVIDIA device plugin. The cloud example values carry GPU tolerations for it.

## LM Studio \[#lm-studio]

Start [LM Studio's local server](https://lmstudio.ai/docs/developer/core/server), load a model, enable **Serve on Local Network**, and [turn on API authentication](https://lmstudio.ai/docs/developer/core/authentication). Then set:

```bash
VLLM_BASE_URL=http://host.docker.internal:1234
VLLM_API_KEY=<lm-studio-api-token>
```

Select the discovered `vllm/<model>` entry in the model picker. A raw model ID typed by hand while the server is unreachable is treated as an Ollama model.

## Check the connection \[#check-the-connection]

```bash
docker compose -f docker-compose.prod.yml exec simstudio printenv OLLAMA_URL VLLM_BASE_URL
```

Each variable the container received prints one line. A missing line means it never reached the container: confirm it is in `.env` and recreate the app with `docker compose -f docker-compose.prod.yml up -d`.
