Go reverse proxy for ollama.com that balances requests across multiple API keys with round-robin and failover on 429/5xx. Exposes both native Ollama API (/api/*) and OpenAI-compatible (/v1/*) passthrough. - Round-robin balancer with per-account cooldown (60s default) - Pre-stream failover: 429 → cooldown + next account; 5xx → next account - Streaming invariant: once 2xx starts streaming, no account switch - SSE (text/event-stream) and NDJSON passthrough with http.Flusher - CLI: accounts add/list/remove/set-base-url, serve, version - Accounts stored in ~/.config/ollama-proxy/accounts.json (chmod 0600) - systemd unit (User=dueattendant149, 127.0.0.1:11435, Restart=always) - 43 tests (unit + integration with httptest upstream) - opencode integration: custom provider 'ocp' with explicit model list - Requires NO_PROXY=127.0.0.1,localhost when HTTP_PROXY is set
28 lines
No EOL
529 B
Makefile
28 lines
No EOL
529 B
Makefile
GO=go
|
|
|
|
.PHONY: build install uninstall vet fmt test clean
|
|
|
|
build:
|
|
$(GO) build -o ollama-proxy .
|
|
|
|
install: build
|
|
install -m 755 ollama-proxy /usr/local/bin/ollama-proxy
|
|
install -m 644 systemd/ollama-proxy.service /etc/systemd/system/ollama-proxy.service
|
|
systemctl daemon-reload
|
|
|
|
uninstall:
|
|
-systemctl disable --now ollama-proxy
|
|
rm -f /usr/local/bin/ollama-proxy /etc/systemd/system/ollama-proxy.service
|
|
systemctl daemon-reload
|
|
|
|
vet:
|
|
$(GO) vet ./...
|
|
|
|
fmt:
|
|
$(GO)fmt -l .
|
|
|
|
test:
|
|
$(GO) test ./...
|
|
|
|
clean:
|
|
rm -f ollama-proxy
|