···11+# Authentication token (required)
22+# Generate a strong random token for production use
33+AUTH_TOKEN=your-secret-token-here
44+55+# Ollama server URL (optional, defaults to http://localhost:11434)
66+OLLAMA_URL=http://localhost:11434
77+88+# Proxy server port (optional, defaults to 8080)
99+PORT=8080
+30
.gitignore
···11+# Binaries for programs and plugins
22+*.exe
33+*.exe~
44+*.dll
55+*.so
66+*.dylib
77+88+# Test binary, built with `go test -c`
99+*.test
1010+1111+# Output of the go build
1212+ollama-proxy
1313+1414+# Go workspace file
1515+go.work
1616+1717+# Environment variables
1818+.env
1919+.env.local
2020+2121+# IDE
2222+.vscode/
2323+.idea/
2424+*.swp
2525+*.swo
2626+*~
2727+2828+# OS
2929+.DS_Store
3030+Thumbs.db
+21
Makefile
···11+.PHONY: build test lint run clean help
22+33+build: ## Build the binary
44+ go build -o ollama-proxy
55+66+test: ## Run tests
77+ go test -v ./...
88+99+lint: ## Run linter
1010+ golangci-lint run
1111+1212+run: ## Run the application (requires AUTH_TOKEN env var)
1313+ go run .
1414+1515+clean: ## Remove build artifacts
1616+ rm -f ollama-proxy
1717+1818+help: ## Show this help message
1919+ @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-15s\033[0m %s\n", $$1, $$2}'
2020+2121+.DEFAULT_GOAL := help
+38
README.md
···11+# Ollama Proxy
22+33+A lightweight Go reverse proxy for Ollama with Bearer token authentication.
44+55+## Features
66+77+- Simple reverse proxy to Ollama API
88+- Bearer token authentication
99+- Easy configuration via environment variables
1010+1111+## Installation
1212+1313+```bash
1414+go install github.com/ollama/ollama-proxy@latest
1515+```
1616+1717+```bash
1818+go build -o ollama-proxy
1919+```
2020+2121+## Configuration
2222+2323+The proxy is configured via environment variables:
2424+2525+- `AUTH_TOKEN` (required): Bearer token for API authentication
2626+- `OLLAMA_URL` (optional): Ollama server URL (default: `http://localhost:11434`)
2727+- `PORT` (optional): Proxy server port (default: `8080`)
2828+2929+## Usage
3030+3131+### Start the proxy
3232+3333+```bash
3434+export AUTH_TOKEN="your-secret-token"
3535+export OLLAMA_URL="http://localhost:11434"
3636+export PORT="8080"
3737+./ollama-proxy
3838+```