[GH-ISSUE #3888] Restrict model pulling based on license #2409

Open
opened 2026-04-12 12:43:12 -05:00 by GiteaMirror · 0 comments
Owner

Originally created by @slyt on GitHub (Apr 24, 2024).
Original GitHub issue: https://github.com/ollama/ollama/issues/3888

It would be great if there was a configurable option to restrict the ability for Ollama server to pull certain models based on the model's license. This is necessary for organizations that would like to use Ollama as a model runtime, but cannot use some models due to limitations in their licenses.

A check could be placed after the model manifest is pulled during PullModel(). If the license in the manifest is on a block list (conversely, not on an allow list), then return an error.

Ideally the allow/block lists could be passed via CLI (e.g. --allow-license ["apache-2.0", "mit"]) or environment variable (e.g. export OLLAMA_ALLOW_LICENSE='["apache-2.0", "mit"]').

The current model manifest only contains the entire raw license text, not a simple license identifier (e.g. apache-2.0). The Licenses page on Huggingface hub docs is a good reference for common license identifiers. Some work might be required to create and track a new license identifier field in the model manifests. Hypothetically, it is possible to compare the raw license text using hashing, but requiring the user to calculate the license hash and pass it like --allow-license-hash ["12345ABCDEF"] is not user friendly.

Its likely that allowing/blocking models based on other attributes in the model manifest (hash, tag, family, etc..) would also be useful by many.

This would be a good alternative to locally hosting the model library with a subset of allowed models: https://github.com/ollama/ollama/issues/914

Originally created by @slyt on GitHub (Apr 24, 2024). Original GitHub issue: https://github.com/ollama/ollama/issues/3888 It would be great if there was a configurable option to restrict the ability for Ollama server to pull certain models based on the model's license. This is necessary for organizations that would like to use Ollama as a model runtime, but cannot use some models due to limitations in their licenses. A check could be placed after [the model manifest](https://github.com/ollama/ollama/blob/790cf34d172e40c0aa4689011b5323cbdd7b83b6/server/images.go#L1034-L1037) is pulled during `PullModel()`. If the license in the manifest is on a block list (conversely, not on an allow list), then return an error. Ideally the allow/block lists could be passed via CLI (e.g. `--allow-license ["apache-2.0", "mit"]`) or environment variable (e.g. `export OLLAMA_ALLOW_LICENSE='["apache-2.0", "mit"]'`). The current model manifest only contains the entire raw license text, not a simple license identifier (e.g. `apache-2.0`). [The Licenses page on Huggingface hub docs](https://huggingface.co/docs/hub/en/repositories-licenses) is a good reference for common license identifiers. Some work might be required to create and track a new license identifier field in the model manifests. Hypothetically, it is possible to compare the raw license text using hashing, but requiring the user to calculate the license hash and pass it like `--allow-license-hash ["12345ABCDEF"]` is not user friendly. Its likely that allowing/blocking models based on other attributes in the model manifest (hash, tag, family, etc..) would also be useful by many. This would be a good alternative to locally hosting the model library with a subset of allowed models: https://github.com/ollama/ollama/issues/914
GiteaMirror added the feature request label 2026-04-12 12:43:12 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#2409