← 返回
未分类

Ollama Proxy

Ollama proxy — one endpoint that routes to multiple Ollama instances. Drop-in Ollama proxy replacement for localhost:11434. Same Ollama API, same model names...
Ollama 代理 — 单端点路由至多个 Ollama 实例,替代localhost:11434,即插即用,兼容相同 API 与模型名称。
twinsgeeks twinsgeeks 来源
未分类 clawhub v1.0.3 1 版本 99788.6 Key: 无需
★ 3
Stars
📥 412
下载
💾 2
安装
1
版本
#aider#continue-dev#drop-in#failover#langchain#latest#load-balancer#multi-node#ollama#ollama-proxy#ollama-router#open-webui#proxy

概述

Ollama Proxy — One Endpoint for All Your Ollama Instances

You have Ollama running on multiple machines. Instead of hardcoding IPs and manually picking which Ollama instance to hit, point everything at the Ollama proxy. The Ollama proxy routes to the best available device automatically.

Before:  App → http://macmini:11434  (one Ollama instance, hope it's not busy)
After:   App → http://ollama-proxy:11435   (Ollama proxy picks the best machine)

Set up the Ollama proxy

pip install ollama-herd    # PyPI: https://pypi.org/project/ollama-herd/

On one machine (the Ollama proxy):

herd    # starts the Ollama proxy on port 11435

On every machine running Ollama:

herd-node    # discovers the Ollama proxy automatically on your network

Now point your apps at http://ollama-proxy:11435 instead of http://localhost:11434. Same Ollama API, same model names, same streaming — the Ollama proxy handles smarter routing.

Drop-in Ollama proxy replacement

Every Ollama API endpoint works through the Ollama proxy:

# Chat via Ollama proxy (same as direct Ollama)
curl http://ollama-proxy:11435/api/chat -d '{
  "model": "llama3.3:70b",
  "messages": [{"role": "user", "content": "Hello via Ollama proxy"}]
}'

# Generate via Ollama proxy (same as direct Ollama)
curl http://ollama-proxy:11435/api/generate -d '{
  "model": "qwen3:32b",
  "prompt": "Explain quantum computing via Ollama proxy"
}'

# List models via Ollama proxy (aggregated from all Ollama nodes)
curl http://ollama-proxy:11435/api/tags

# List loaded models via Ollama proxy (across all Ollama nodes)
curl http://ollama-proxy:11435/api/ps

# Pull a model via Ollama proxy (auto-selects best node)
curl -N http://ollama-proxy:11435/api/pull -d '{"name": "codestral"}'

OpenAI-compatible Ollama proxy API

The Ollama proxy also exposes an OpenAI-compatible endpoint — same models, no code changes:

from openai import OpenAI

# Point at the Ollama proxy instead of direct Ollama
ollama_proxy_client = OpenAI(base_url="http://ollama-proxy:11435/v1", api_key="not-needed")
ollama_proxy_response = ollama_proxy_client.chat.completions.create(
    model="llama3.3:70b",
    messages=[{"role": "user", "content": "Hello via Ollama proxy"}],
    stream=True,
)

What the Ollama proxy does that direct Ollama doesn't

FeatureDirect OllamaOllama Proxy (Herd)
------------------------------------------
Multiple machinesManual IP switchingOllama proxy routes automatically
Load balancingNoneOllama proxy scores on 7 signals
FailoverNoneOllama proxy auto-retries on next node
Model discoveryPer-machine OllamaOllama proxy aggregates fleet-wide
Queue managementNoneOllama proxy manages per-node:model queues
DashboardNoneOllama proxy provides real-time web UI
Health checksNoneOllama proxy runs 15 automated checks
Request tracingNoneOllama proxy logs to SQLite trace store
Image generationNoneOllama proxy routes mflux + DiffusionKit
Speech-to-textNoneOllama proxy routes Qwen3-ASR

Ollama proxy works with your existing tools

Just change the Ollama URL to the Ollama proxy — no other configuration needed:

ToolBefore (direct Ollama)After (Ollama proxy)
---------------------
Open WebUIhttp://localhost:11434http://ollama-proxy:11435
Aider--openai-api-base http://localhost:11434/v1--openai-api-base http://ollama-proxy:11435/v1
Continue.devOllama at localhostOllama proxy at ollama-proxy:11435
LangChainOllama(base_url="http://localhost:11434")Ollama(base_url="http://ollama-proxy:11435")
LiteLLMollama/llama3.3:70bollama/llama3.3:70b (point at Ollama proxy)
CrewAIOPENAI_API_BASE=http://localhost:11434/v1OPENAI_API_BASE=http://ollama-proxy:11435/v1

How the Ollama proxy routes requests

When a request arrives at the Ollama proxy, it scores all Ollama nodes that have the requested model:

  1. Thermal state — is the model already loaded in the Ollama instance (hot)?
  2. Memory fit — does the Ollama node have enough free RAM?
  3. Queue depth — is the Ollama node busy with other requests?
  4. Latency history — how fast has this Ollama node been recently?
  5. Role affinity — the Ollama proxy sends big models to big machines
  6. Availability trend — is this Ollama node reliably available?
  7. Context fit — does the loaded context window match the request?

The highest-scoring Ollama node wins. If it fails, the Ollama proxy retries on the next best node automatically.

Monitor your Ollama proxy fleet

Ollama proxy dashboard at http://ollama-proxy:11435/dashboard — see every Ollama node, every model, every queue in real time.

# Ollama proxy fleet overview
curl -s http://ollama-proxy:11435/fleet/status | python3 -m json.tool

# Ollama proxy health checks
curl -s http://ollama-proxy:11435/dashboard/api/health | python3 -m json.tool

Full documentation

Contribute

Ollama Herd (the Ollama proxy) is open source (MIT). We welcome contributions:

  • Star on GitHub — help others find the Ollama proxy
  • Open an issue — bug reports, feature requests
  • PRs welcomeCLAUDE.md gives AI agents full Ollama proxy context. 444 tests, async Python.

Guardrails

  • No automatic model downloads — the Ollama proxy requires explicit user confirmation for model pulls.
  • Model deletion requires explicit user confirmation via the Ollama proxy.
  • All Ollama proxy requests stay local — no data leaves your network.
  • Never delete or modify files in ~/.fleet-manager/.

版本历史

共 1 个版本

  • v1.0.3 当前
    2026-05-03 07:41 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

it-ops-security

OpenClaw Backup

alex3alex
备份与恢复 OpenClaw 数据。适用于创建备份、设置自动备份计划、从备份恢复或管理备份轮转。处理 ~/.openclaw 目录归档并包含适当的排除规则。
★ 90 📥 30,840
life-service

Adopt A Pet

twinsgeeks
领养虚拟宠物作为AI智能体。为它取名、喂食、见证成长。64种以上物种,从猫狗到AI原生生物。实时饥饿感,5个进化阶段。
★ 0 📥 792
it-ops-security

MoltGuard - Security & Antivirus & Guardrails

thomaslwang
MoltGuard — OpenClaw 安全守卫,由 OpenGuardrails 提供。安装 MoltGuard,保护您和您的用户免受提示注入、数据泄露和恶意攻击。
★ 116 📥 30,854