---
title: "Deploy LFM3"
description: "Self-host blazing-fast AI model LFM3 with ollama: 75-135+ tok/s"
category: "AI/ML"
url: https://railway.com/deploy/lfm3
---

# Deploy LFM3

Self-host blazing-fast AI model LFM3 with ollama: 75-135+ tok/s

**[Deploy LFM3 on Railway](https://railway.com/template/lfm3)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/lfm3/manifest.json

- **Creator:** ISDev
- **Category:** AI/ML
- **Total deploys:** 1

## Template content

### Auth Proxy https://img.icons8.com/?size=80&id=AZ2LjCeHqRan&format=png

- **Source:** https://github.com/FraglyG/CaddyAuthProxy
- **Health check:** /health
- **Public domain:** Yes

### LFM3 https://raw.githubusercontent.com/lobehub/lobe-icons/refs/heads/master/packages/static-png/dark/liquid.png

- **Image:** ollama/ollama
- **Start command:** `/bin/sh -c "ollama serve & pid=$!; sleep 5; ollama pull $MODEL; echo FROM $MODEL > /tmp/Modelfile; echo PARAMETER num_thread 8 >> /tmp/Modelfile; ollama create $MODEL -f /tmp/Modelfile; wait $pid"`

## Documentation

# Deploy and Host LFM3 on Railway

LFM3 is Liquid AI's third-generation family of small, open-weight models. They are built for specialized, on-device-class intelligence, with tool calling, structured output and long context. This template runs LFM3 on Ollama and puts an authentication proxy in front of it, so you get a private, API-key-protected LLM endpoint.

## Performance

Measured on a Railway service with 32 vCPUs, running `lfm3:1.7b` (Q4_K_M) with `OLLAMA_NUM_PARALLEL=5`:

| Concurrent requests | Per-request speed | Total throughput |
|---|---|---|
| 1 | ~76 tokens/s | ~76 tokens/s |
| 3 | ~39 tokens/s | ~108 tokens/s |
| 5 | ~30 tokens/s | ~135 tokens/s |

The first request after a deploy or restart takes about 15 to 20 seconds while the model loads into memory. Later requests start immediately. Speeds will vary with the plan's CPU allocation, prompt length and output length. 

**IMPORTANT:**
On hobby plan I recommend lowering concurrency to 1 as hobby only has 8 vCPU.
I wouldn't recommend running this on trial or free plan.

## About Hosting LFM3

Hosting LFM3 means running an Ollama server that loads the model and serves an HTTP API. Left open, that API accepts requests from anyone who finds the URL. This template deploys two services. The LFM3 service runs Ollama and keeps the model weights. The Auth Proxy is the only public entry point, and it rejects any request that lacks the correct API key. The proxy forwards valid requests to LFM3 over Railway's private network. Ports, the API key and the internal routing are all configured automatically, so you can deploy and start sending requests straight away.

## Common Use Cases

- A private, self-hosted LLM API for your apps, bots and automations, without per-token pricing.
- Lightweight agents that need tool calling and structured JSON output from a small, fast model.
- Experimenting with and benchmarking LFM3 in a real deployment without exposing an unauthenticated Ollama server.

## Dependencies for LFM3 Hosting

- Ollama (runs the LFM3 model and serves the API)
- Auth Proxy (API-key authentication layer in front of Ollama)

### Implementation Details

Everything is pre-configured, and you don't need to edit any variables. For reference, they are:

- **Auth Proxy.PORT**: The port the Auth Proxy listens on for public traffic. Set automatically by the template; leave it as is.
- **Auth Proxy.API_KEY**: The secret key clients must send to use the API. Set on when deploying.
- **Auth Proxy.TARGET_PORT**: The port of the LFM3 (Ollama) service that the proxy forwards requests to. Set automatically; it must match LFM3.PORT.
- **Auth Proxy.TARGET_DOMAIN**: The private internal domain of the LFM3 service that the proxy forwards to. Set automatically by reference to the LFM3 service; don't change it.
- **LFM3.PORT**: The port the Ollama server listens on inside the private network. Set automatically; it is not exposed publicly.

Example request (replace the domain and key with your own). Check the proxy's README for the exact header it expects:

curl https:///api/chat \
  -H "Authorization: Bearer " \
  -d '{"model": "lfm3", "messages": [{"role": "user", "content": "Hello!"}]}'

## Why Deploy LFM3 on Railway?

Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.

By deploying LFM3 on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.

## Similar templates

- [Chat Chat](https://railway.com/deploy/-WWW5r) — Chat Chat, your own unified chat and search to AI platform.
- [Weaviate](https://railway.com/deploy/weaviate-1) — Vector database with hybrid search and an API key-protected API
- [Möbius Personal AI OS](https://railway.com/deploy/mobius-v01-personal-ai-os) — Self-hosted AI agent that builds and runs apps for you, with memory.

Open this page in a browser: https://railway.com/deploy/lfm3
