[GH-ISSUE #5386] Add environment variable for "read only" mode #49878

Open
opened 2026-04-28 13:16:47 -05:00 by GiteaMirror · 3 comments
Owner

Originally created by @steren on GitHub (Jun 29, 2024).
Original GitHub issue: https://github.com/ollama/ollama/issues/5386

When running as a server, Ollama currently exposes all Ollama features as an API

If run as a public API, API maintainers might want to only expose Ollama's generation and model listing capabilities, so that their endpoint is "read only", and not other endpoints that could mutate the server's state (push, pull, delete...)

We could imagine an environment variable like OLLAMA_READ_ONLY that would achieve the above.

Originally created by @steren on GitHub (Jun 29, 2024). Original GitHub issue: https://github.com/ollama/ollama/issues/5386 When running as a server, Ollama currently exposes all Ollama features as [an API](https://github.com/ollama/ollama/blob/main/docs/api.md) If run as a public API, API maintainers might want to only expose Ollama's generation and model listing capabilities, so that their endpoint is "read only", and not other endpoints that could mutate the server's state (push, pull, delete...) We could imagine an environment variable like `OLLAMA_READ_ONLY` that would achieve the above.
GiteaMirror added the feature request label 2026-04-28 13:16:47 -05:00
Author
Owner

@steren commented on GitHub (Jun 29, 2024):

CC @wietsevenema

<!-- gh-comment-id:2198336055 --> @steren commented on GitHub (Jun 29, 2024): CC @wietsevenema
Author
Owner

@rick-github commented on GitHub (Jun 29, 2024):

Presumably you're running some other infra around the server, and not just putting a naked ollama server on the internet. Could you not run a proxy in front of it, and then null out or require auth on endpoints that mutate server state?

<!-- gh-comment-id:2198345663 --> @rick-github commented on GitHub (Jun 29, 2024): Presumably you're running some other infra around the server, and not just putting a naked ollama server on the internet. Could you not run a proxy in front of it, and then null out or require auth on endpoints that mutate server state?
Author
Owner

@steren commented on GitHub (Jun 29, 2024):

I agree, that's what is recommended.

But we won't prevent users to just expose the raw Ollama API, I'd rather have a "one env var" way to make it read only, than to ask everyone to setup a proxy.

<!-- gh-comment-id:2198348000 --> @steren commented on GitHub (Jun 29, 2024): I agree, that's what is recommended. But we won't prevent users to just expose the raw Ollama API, I'd rather have a "one env var" way to make it read only, than to ask everyone to setup a proxy.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#49878