Guides
Expose a Local LLM
Give a local Ollama or LM Studio model an HTTPS address so teammates, apps and other devices can call its API. Keep it private with a header or allowlist.
Summary
How it works#
Ollama and LM Studio serve an HTTP API on a local port. The agent carries requests from the tunnel's address to that port and returns the model's response, streamed as it is produced.
You need a Localport account, the Localport agent, and Ollama or LM Studio running on your machine.
Ollama#
Ollama listens on port 11434. Create an HTTP tunnel in the dashboard, then run:
localport http 11434 --token tok_YOUR_TOKEN --region eu
Call the API on the tunnel's address:
curl https://my-application.eu.localport.dev/api/generate -d '{
"model": "llama3.2",
"prompt": "Explain TCP tunneling in one paragraph",
"stream": false
}'
Ollama answers 403 until it listens on all interfaces
OLLAMA_HOST=0.0.0.0 and it accepts requests sent to the tunnel's address. That setting also makes Ollama reachable from your local network.LM Studio#
LM Studio's local server listens on port 1234 and speaks the OpenAI API format:
localport http 1234 --token tok_YOUR_TOKEN --region eu
curl https://my-application.eu.localport.dev/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "local-model",
"messages": [{"role": "user", "content": "Hello"}]
}'
Any tool that takes an OpenAI base URL can point at https://my-application.eu.localport.dev/v1.
Keep the endpoint private#
A tunnel is public by default, and a model API answers anyone who calls it. Add one of these before you share the address:
- Header Authentication admits only requests that carry a header and value you set. Most API clients can send a custom header, so this suits a model endpoint.
- IP Allowlists accept connections only from the addresses you name, such as your office.
- Basic Auth asks for a username and password.
Point your tools at it#
| Tool | Setting to change |
|---|---|
| Continue | The model's apiBase |
| Open WebUI | The Ollama API URL |
| Your own scripts | The base URL, in place of http://localhost:11434 |
Set a subdomain in the tunnel's settings so the address in your team's configuration never changes.
Keep the model loaded#
Ollama unloads a model after a period with no requests, and the next caller waits while it loads again. Start Ollama with OLLAMA_KEEP_ALIVE=-1 to keep the model in memory.
Frequently asked questions#
How do I share Ollama with my team?
Start Ollama with OLLAMA_HOST=0.0.0.0, run localport http 11434 --token tok_YOUR_TOKEN --region eu, and give teammates the tunnel's address. Add header authentication first so only they can call it.
Why does Ollama return 403 through the tunnel?
With its default settings Ollama refuses requests addressed to a host name other than its own. Start it with OLLAMA_HOST=0.0.0.0.
Do streamed responses work?
Yes. A response is passed on as the model produces it.
Can Localport read my prompts?
Localport does not log or store what you send. On an HTTP tunnel a request is decrypted in memory to route it and is never written to disk.
Should I use an HTTP tunnel or a TCP tunnel?
An HTTP tunnel. Ollama and LM Studio serve HTTP, and an HTTP tunnel gives you HTTPS with a trusted certificate and the per-request controls. A TCP tunnel carries the same traffic without them.
Does the address stay the same?
Yes. The address belongs to the tunnel and is the same after every restart of the agent.
What to read next#
- HTTP Tunnels. Create the tunnel and set its subdomain.
- Header Authentication. Admit only callers that send your header.
- IP Allowlists. Admit only the addresses you name.
- Basic Auth. A username and password in front of the tunnel.