Spaces:
Paused
Paused
Update README.md
Browse files
README.md
CHANGED
|
@@ -1,11 +1,64 @@
|
|
| 1 |
---
|
| 2 |
-
title: Ollama
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo:
|
| 6 |
sdk: docker
|
| 7 |
-
|
| 8 |
-
short_description: Ollama server with small models
|
| 9 |
---
|
| 10 |
|
| 11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
title: Authenticated Ollama API with Admin Panel
|
| 3 |
+
emoji: π
|
| 4 |
+
colorFrom: blue
|
| 5 |
+
colorTo: green
|
| 6 |
sdk: docker
|
| 7 |
+
app_port: 7860
|
|
|
|
| 8 |
---
|
| 9 |
|
| 10 |
+
# π Authenticated Ollama API Server with Admin Panel
|
| 11 |
+
|
| 12 |
+
A secure FastAPI wrapper around Ollama with **dual authentication** - regular API keys for model operations and admin keys for key management.
|
| 13 |
+
|
| 14 |
+
## π Features
|
| 15 |
+
|
| 16 |
+
- **π Dual Authentication System** - Separate API and Admin keys
|
| 17 |
+
- **π¦ Llama 3.2 1B Model** - Pre-loaded and ready to use
|
| 18 |
+
- **π§ Admin Key Management** - Secure key retrieval and rotation
|
| 19 |
+
- **π‘ Complete REST API** - All Ollama endpoints wrapped
|
| 20 |
+
- **π Interactive Docs** - Built-in Swagger UI
|
| 21 |
+
- **π Health Monitoring** - Comprehensive service status
|
| 22 |
+
- **π Admin Logs** - Access logs and usage statistics
|
| 23 |
+
|
| 24 |
+
## π Two-Level Authentication
|
| 25 |
+
|
| 26 |
+
### **API Key** (Regular Users)
|
| 27 |
+
- Use for all model operations (generate, chat, pull, etc.)
|
| 28 |
+
- Retrieved from logs or admin endpoints
|
| 29 |
+
|
| 30 |
+
### **Admin Key** (Administrators)
|
| 31 |
+
- Use for key management and administrative functions
|
| 32 |
+
- Required for sensitive operations
|
| 33 |
+
|
| 34 |
+
## π API Endpoints
|
| 35 |
+
|
| 36 |
+
### **Public Endpoints (No Auth Required)**
|
| 37 |
+
- `GET /` - API information
|
| 38 |
+
- `GET /health` - Health check
|
| 39 |
+
- `GET /docs` - Interactive documentation
|
| 40 |
+
|
| 41 |
+
### **API Key Endpoints (Require API Key)**
|
| 42 |
+
- `GET /api/tags` - List models
|
| 43 |
+
- `POST /api/generate` - Generate text
|
| 44 |
+
- `POST /api/chat` - Chat with model
|
| 45 |
+
- `POST /api/pull` - Pull new models
|
| 46 |
+
- `DELETE /api/delete` - Delete models
|
| 47 |
+
- `GET /auth/test` - Test API authentication
|
| 48 |
+
|
| 49 |
+
### **Admin Endpoints (Require Admin Key)**
|
| 50 |
+
- `GET /admin/info` - Admin panel information
|
| 51 |
+
- `GET /admin/api-key` - π Retrieve current API key
|
| 52 |
+
- `GET /admin/key-info` - Get key info (without exposing key)
|
| 53 |
+
- `POST /admin/rotate-key` - π Generate new API key
|
| 54 |
+
- `GET /admin/logs` - π View server logs
|
| 55 |
+
- `GET /admin/stats` - π Usage statistics
|
| 56 |
+
- `GET /admin/test` - Test admin authentication
|
| 57 |
+
|
| 58 |
+
## π Getting Your Keys
|
| 59 |
+
|
| 60 |
+
### **From Server Logs (Recommended)**
|
| 61 |
+
1. Check your Space logs for the startup message showing both keys
|
| 62 |
+
2. Look for the section with API Key and Admin Key
|
| 63 |
+
|
| 64 |
+
### **Via Admin Endpoint (Alternative)**
|