このページはまだお使いの言語に翻訳されていないか、翻訳が技術レビュー待ちです。以下には英語の原文を表示しています。 英語のページを開く
Ollama Integration
Add governance to locally-hosted Ollama models. Control Zero intercepts Ollama API calls through the Governance Gateway and enforces your dashboard policies on every request.
Overview
Ollama runs open-source LLMs locally. When routed through the Control Zero Governance Gateway, every chat completion and model interaction is governed by your policies and logged for audit.
Ollama uses an OpenAI-compatible wire format, so the integration reuses the same interceptors and policy enforcement as the OpenAI integration.
Setup
1. Configure the Gateway
Enable the Ollama provider in your Governance Gateway configuration:
# Environment variables for the gateway
CZ_GATEWAY_OLLAMA_ENABLED=true
CZ_GATEWAY_OLLAMA_API_URL=http://localhost:11434/v1
2. Route Requests Through the Gateway
Instead of calling Ollama directly, point your client at the gateway's Ollama endpoint:
import openai
# Route through Control Zero gateway instead of direct Ollama
client = openai.OpenAI(
base_url="http://localhost:8000/ollama/v1",
api_key="cz_live_your_key_here",
)
response = client.chat.completions.create(
model="llama3",
messages=[{"role": "user", "content": "Summarize this quarter's sales data."}],
)
print(response.choices[0].message.content)