Run Local Inference with Ollama
This tutorial covers two Ollama deployments:
- The self-contained Ollama community sandbox. This is the recommended path.
- A host-level Ollama service shared by explicitly authorized sandboxes.
Prerequisites
Complete the Quickstart before proceeding.
Option A: Ollama Community Sandbox
The community image bundles Ollama and supported coding agents:
Inside the sandbox, run a local or cloud model:
Or launch a coding agent against Ollama:
For an automated workflow:
Useful starter models include qwen3.5:0.8b for smoke tests and qwen3.5
for coding and tool use. Check the
Ollama model library for current model details.
Update the bundled Ollama installation with update-ollama, or request an
update at sandbox start:
Option B: Host-level Ollama
Use this path when Ollama runs on the same machine as the OpenShell gateway and selected sandboxes should share it.
Start Ollama on a Reachable Address
In another terminal, pull a model:
Import an Endpoint-bearing Profile
Save this as ollama-openai.yaml:
The provider has no secret because this Ollama server does not authenticate. Its attachment still carries the endpoint and binary policy.
Attach and Verify
For an OpenAI SDK client, set its base URL to
http://host.openshell.internal:11434/v1, use any non-empty API key value the
SDK accepts, and select the real Ollama model in the request.
Troubleshooting
- Bind host-level Ollama to
0.0.0.0, not127.0.0.1. - Use
host.openshell.internal, notlocalhost, from a sandbox. - Confirm attachment with
openshell sandbox provider list ollama-client. - Inspect the effective policy with
openshell policy get ollama-client --full. - Run
ollama psandollama pull <model>when the model is unavailable. - If the gateway is remote, the hostname refers to the remote gateway host, not your laptop. Use a shared service address or tunnel instead.