https://github.com/mohith-das/ollama-server
JWT-protected FastAPI proxy for Ollama.
https://github.com/mohith-das/ollama-server
fastapi jwt ollama proxy python
Last synced: 2 days ago
JSON representation
JWT-protected FastAPI proxy for Ollama.
- Host: GitHub
- URL: https://github.com/mohith-das/ollama-server
- Owner: mohith-das
- Created: 2026-01-03T21:41:20.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2026-01-03T22:15:31.000Z (6 months ago)
- Last Synced: 2026-03-01T08:33:55.079Z (4 months ago)
- Topics: fastapi, jwt, ollama, proxy, python
- Language: Python
- Size: 17.1 MB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Ollama Server Middleware
JWT-protected FastAPI proxy for Ollama with token issuance and request forwarding.
## Highlights
- Password-protected token creation with expiry.
- Bearer auth enforced on proxy routes.
- Streams Ollama responses through a protected endpoint.
## Tech
Python, FastAPI, JWT, Ollama
## Setup
```bash
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
```
## Configuration
Set environment variables as needed:
- `SECRET_KEY` (default: `default_secret_key`)
- `TOKEN_PASSWORD` (default: `default_token_password`)
- `TOKEN_EXPIRE_HOURS` (default: `4`)
- `OLLAMA_API_URL` (default: `http://127.0.0.1:11434/`)
## Run
```bash
uvicorn auth_middleware:app --host 0.0.0.0 --port 8000
```
## Endpoints
- `POST /generate-token`
- `POST /protected/{path}`
- `POST /revoke-token`
- `GET /status`