A minimal Flask proxy server that forwards requests to a local Ollama server with token-based authentication.
- Token-based authentication for API access
- Forwarding of all HTTP methods (GET, POST) to local Ollama server
- Health check endpoint
- Mock tokens included in
tokens.json - External config file
ollama.ini
-
Install dependencies:
pip install -r requirements.txt
-
Run the proxy server:
python app.py
-
The proxy will be available at
http://localhost:8181
To access the Ollama server through the proxy, include a valid token in the Authorization header:
curl -H "Authorization: Bearer token_12345" http://localhost:8181/api/generateTokens are available in tokens.json:
GET /health- Health check endpoint- All other endpoints are proxied to
http://localhost:11434(default Ollama server)
The proxy uses an external configuration file ollama.ini to specify the Ollama server address and port.
Example configuration:
[ollama]
host = localhost
port = 11434The proxy assumes the local Ollama server is running at http://localhost:11434. If your Ollama server runs on a different port or address, modify the ollama.ini file accordingly.