From 29fe7c5bd01454f72296af61ff189d1e69e39085 Mon Sep 17 00:00:00 2001 From: jochen Date: Mon, 7 Sep 2026 05:25:21 +0200 Subject: [PATCH] local model: an ollama provider + a local-model consumer (ADR 0055) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Model access answered by a NODE, not a licence. `ollama` runs the model server on host network (0.0.0.0:11434) and provides model-access at node scope, serving its port and model — it mints nothing, so it is server-only, no runtime. The `local-model-consumer` requires model-access, gets the endpoint (no secret), and its templated openai.env carries OPENAI_BASE_URL=http://:/v1 + OPENAI_MODEL. One provision, two answers: the mesh's own model behind the same interface as a vendor's. Proven end to end by the mesh-lab local-model bed (green). Claude-Session: https://claude.ai/code/session_01LrgweAeERJYBg88c5cKDzF --- modules/local-model-consumer/module.json | 32 ++++++++++++++++ modules/ollama/module.json | 48 ++++++++++++++++++++++++ 2 files changed, 80 insertions(+) create mode 100644 modules/local-model-consumer/module.json create mode 100644 modules/ollama/module.json diff --git a/modules/local-model-consumer/module.json b/modules/local-model-consumer/module.json new file mode 100644 index 0000000..d432025 --- /dev/null +++ b/modules/local-model-consumer/module.json @@ -0,0 +1,32 @@ +{ + "module": "local-model-consumer", + "version": "1", + "slug": "local", + "requires": [ + "model-access" + ], + "binds": { + "model-access": "/var/lib/local-model-consumer/model.json" + }, + "resources": [ + { + "id": "state", + "type": "directory", + "path": "/var/lib/local-model-consumer", + "mode": "0700" + }, + { + "id": "config", + "type": "directory", + "path": "/var/lib/local-model-consumer/config", + "mode": "0700" + }, + { + "id": "openai-env", + "type": "file", + "path": "/var/lib/local-model-consumer/config/openai.env", + "mode": "0600", + "content": "OPENAI_BASE_URL=http://${bound:model-access:at}:${bound:model-access:port}/v1\nOPENAI_MODEL=${bound:model-access:model}\nOPENAI_API_KEY=local\n" + } + ] +} diff --git a/modules/ollama/module.json b/modules/ollama/module.json new file mode 100644 index 0000000..73d8b02 --- /dev/null +++ b/modules/ollama/module.json @@ -0,0 +1,48 @@ +{ + "module": "ollama", + "version": "1", + "capabilities": [ + "container-runtime" + ], + "provides": [ + { + "name": "model-access", + "scope": "node" + } + ], + "listens": [ + { + "port": 11434, + "protocol": "tcp", + "from": "machine", + "why": "consumers on this machine reaching the local model server's OpenAI-compatible API" + } + ], + "serves": { + "model-access": { + "port": 11434, + "model": "llama3.2" + } + }, + "resources": [ + { + "id": "state", + "type": "directory", + "path": "/services/ollama", + "mode": "0700" + }, + { + "id": "server", + "type": "container", + "name": "ollama", + "image": "ollama/ollama@sha256:32931b46719f673c05fdbaa81ccb26da18ea4a1c57590a754874ab28ba269eb2", + "network": "host", + "env": { + "OLLAMA_HOST": "0.0.0.0:11434" + }, + "volumes": [ + "/services/ollama:/root/.ollama" + ] + } + ] +} -- 2.54.0