How to give Ollama a public OpenAI-compatible endpoint

Ollama already speaks the OpenAI API format on your machine — the hard part is reaching it from anywhere else, safely. This guide adds a public HTTPS endpoint with authentication in front of your local model, with no port forwarding and no prompts stored.

The problem

Ollama serves models on localhost:11434 with an OpenAI-compatible API — but only on your machine, and with no authentication. Exposing that port to the internet directly (or through a generic tunnel) means anyone who finds the URL can use your GPU. What you actually want is a public endpoint that speaks the OpenAI API, requires a key, and leaves your network closed.

Mealissa is a secure, OpenAI- and Anthropic-compatible gateway that gives self-hosted local LLMs a globally accessible API endpoint, with prompts encrypted in transit and never stored. The mealissa-llm-agent connects outbound from your machine, so nothing is opened to the public internet — see how this compares to ngrok and Tailscale.


Step-by-step

01

Run a model in Ollama

Install Ollama and pull any model from the Ollama library:

Terminal
ollama pull qwen2.5:4b
02

Get a license key

Create an account on the cloud dashboard. The free Pico plan and a 7-day trial are available — see licensing plans. The license key doubles as the API key your callers will use.

03

Run the mealissa-llm-agent

Download the agent for Windows or Linux and launch it. It detects your Ollama models, connects outbound to the Mealissa cloud over an encrypted channel, and registers your node — no port forwarding, no firewall changes. The full walkthrough is in the install guide.

04

Point the OpenAI SDK at your endpoint

Your node now has an OpenAI Chat Completions–compatible endpoint. Use the node ID you chose during registration (also shown in the dashboard):

Python
from openai import OpenAI

client = OpenAI(
    base_url="https://mealissa.com/cloud/n/<node_id>/v1",
    api_key="<license_key>",
)

response = client.chat.completions.create(
    model="qwen2.5:4b",
    messages=[{"role": "user", "content": "Hello!"}],
)
print(response.choices[0].message.content)

Or with plain HTTP from anywhere:

curl
curl -s -X POST https://mealissa.com/cloud/n/<node_id>/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <license_key>" \
  -d '{"model":"qwen2.5:4b","messages":[{"role":"user","content":"Hello!"}]}'

Streaming works the standard way — pass stream=true and consume the response as you would with any OpenAI-compatible server.

05

Optional: group several machines

If you run the agent on more than one machine in the same group, use the group endpoint instead — requests are dispatched to a connected node in the group:

base_url="https://mealissa.com/cloud/g/<group_id>/v1"

What you get

  • OpenAI-compatible — existing OpenAI SDK code works by changing only the base URL and key. The same endpoint also speaks the Anthropic Messages API.
  • Authenticated — every request needs your license key; revoke or replace it from the dashboard.
  • Private — prompts are encrypted in transit and never stored. Your network stays closed; the agent only makes outbound connections.

Ready to try it?

A free Pico plan and a 7-day trial are available — no card required.

View licensing plans Go to downloads →