Proxy HTTP transparent qui intercepte toutes les requĂȘtes Ollama et extrait les tokens automatiquement.
Your App â Proxy (11435) â Real Ollama (11434)
â
Token Extraction
â
Monitor Backend
npm install
npm start
Ăcoute sur: http://127.0.0.1:11435
Build simple:
docker build -t sebchevre/ollama-proxy:1.2.0 .
docker run -p 11435:11435 \
-e PROXY_PORT=11435 \
-e OLLAMA_HOST=host.docker.internal \
-e OLLAMA_PORT=11434 \
-e MONITOR_URL=http://ollama-monitoring:3333 \
-e LOG_FILE=/data/proxy-log.json \
sebchevre/ollama-proxy:1.2.0
Build multiplateforme et push sur Docker Hub:
docker buildx build --platform linux/amd64,linux/arm64 \
-t sebchevre/ollama-proxy:1.2.0 \
-t sebchevre/ollama-proxy:latest \
--push .
Configuration requise pour buildx:
# Créer un builder multiplateforme (une seule fois)
docker buildx create --name mybuilder --use
docker buildx ls
| Variable | Défaut | Description |
|---|---|---|
PROXY_PORT | 11435 | Port d'écoute du proxy |
OLLAMA_HOST | 127.0.0.1 | Host du vrai Ollama |
OLLAMA_PORT | 11434 | Port du vrai Ollama |
MONITOR_URL | http://localhost:3333â | URL du monitoring backend |
LOG_FILE | ./data/proxy-log.json | Fichier log des requĂȘtes |
Voir le fichier docker-compose.yml dans le projet openwebui-monitoring pour un exemple complet avec tous les services:
cd /Users/seb/OLLAMA/openwebui-monitoring
docker compose -f docker-compose.yml up -d
# Build simple (local)
docker build -t sebchevre/ollama-proxy:1.2.0 .
# Build multiplateforme et push
docker buildx build --platform linux/amd64,linux/arm64 \
-t sebchevre/ollama-proxy:1.2.0 \
-t sebchevre/ollama-proxy:latest \
--push .
# Tagger une version
docker tag sebchevre/ollama-proxy:1.2.0 sebchevre/ollama-proxy:latest
docker push sebchevre/ollama-proxy:latest
# Build et lancer
docker build -t sebchevre/ollama-proxy:test .
docker run -p 11435:11435 \
-e PROXY_PORT=11435 \
-e OLLAMA_HOST=localhost \
-e OLLAMA_PORT=11434 \
sebchevre/ollama-proxy:test
# Test du proxy
curl http://localhost:11435/health
# Logs
docker logs -f <container-id>
# VĂ©rifier les requĂȘtes
curl -X POST http://localhost:11435/api/chat \
-H "Content-Type: application/json" \
-d '{"model":"qwen3:latest","messages":[{"role":"user","content":"hello"}]}'
GET /health - Health checkGET /proxy-stats - Statistiques du proxyTous les autres endpoints sont proxifiés vers Ollama.
â Transparent: Fonctionne comme Ollama, pas de changement d'API â Automatic Token Tracking: Capture les tokens de toutes les rĂ©ponses â Stream Support: GĂšre le streaming et non-streaming â Persistent Logging: Enregistre toutes les requĂȘtes â Lightweight: Overhead minimal (<100ms)
export OLLAMA_HOST="127.0.0.1:11435"
curl -X POST http://127.0.0.1:11435/api/generate \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-oss",
"prompt": "Hello",
"stream": false
}'
VĂ©rifiez le dashboard: http://localhost:3333â
stream: false pour les requĂȘtes internes (capture plus facile)/data/proxy-log.json/api/recordcurl http://127.0.0.1:11434/api/tagsOLLAMA_HOST et OLLAMA_PORTMONITOR_URL est correctlsof -i :11435
kill -9 <PID>
Pour plus d'infos: Voir le README principal
Content type
Image
Digest
sha256:dfc8df48bâŠ
Size
45.5 MB
Last updated
7 months ago
docker pull sebchevre/ollama-proxy