Spaces:
Running
Running
metadata
title: MOFH API Proxy
emoji: π
colorFrom: blue
colorTo: green
sdk: docker
sdk_version: 4.36.0
python_version: '3.11'
app_file: app.py
pinned: false
π IONA AI + MOFH API Proxy
Intelligent Website Generator & MyOwnFreeHost API Proxy
β¨ Features
- π€ AI Website Generation - Generate complete websites with HTML, CSS, JS, and MySQL
- π MOFH Integration - Create free hosting accounts via API
- π Beautiful Dashboard - Real-time system monitoring with uptime display
- π External IP Display - Easy MOFH whitelist configuration
- π₯ Health Checks - Monitor system health and performance
- π§ͺ Test Endpoints - Verify AI functionality before use
π― Quick Start
1. Visit Dashboard
https://your-space.hf.space/
2. Copy External IP
- Displayed prominently on dashboard
- Add to MOFH API whitelist
3. Test AI
https://your-space.hf.space/test
4. Generate Website
curl -X POST https://your-space.hf.space/generate-website \
-H "Content-Type: application/json" \
-d '{
"prompt": "Create a modern portfolio website",
"business_type": "portfolio",
"color_scheme": "modern"
}'
π‘ API Endpoints
| Method | Endpoint | Description |
|---|---|---|
| GET | / |
System dashboard (HTML) |
| GET | /health |
Health check (JSON) |
| GET | /test |
Test AI generation |
| POST | /generate-website |
Generate website with AI |
| POST | /create |
Create MOFH hosting account |
π§ Configuration
Environment Variables
GROQ_API_KEYS- Groq AI API keys (4 keys for load balancing)MOFH_API_USERNAME- MOFH API usernameMOFH_API_PASSWORD- MOFH API password
AI Models (2026)
llama-3.1-8b-instant- Fastest (131K context)llama-3.3-70b-versatile- Best qualityqwen/qwen3-32b- Large output (40K tokens)meta-llama/llama-4-scout-17b-16e-instruct- New Llama 4
π Dashboard Features
- β±οΈ Uptime Tracking - Running since, uptime duration
- π Network Info - Hostname, local IP, external IP
- π» System Resources - CPU usage, memory usage with progress bars
- π€ AI Configuration - Active models, API keys, request counts
- π Request Statistics - Total, generate, create, errors
- π Auto-Refresh - Updates every 30 seconds
π§ͺ Testing
Health Check
curl https://your-space.hf.space/health
AI Test
curl https://your-space.hf.space/test
Generate Website
curl -X POST https://your-space.hf.space/generate-website \
-H "Content-Type: application/json" \
-d '{
"prompt": "Create a simple landing page for a tech startup",
"business_type": "landing",
"color_scheme": "modern",
"include_database": false,
"features": ["contact_form", "testimonials"]
}'
π Response Format
Success Response
{
"success": true,
"model_used": "llama-3.3-70b-versatile",
"files": {
"html": "<!DOCTYPE html>...",
"css": "body { ... }",
"js": "console.log('...');",
"sql": "CREATE TABLE...",
"config": "<?php...",
"readme": "# Setup Guide..."
},
"tokens_used": {
"prompt_tokens": 1234,
"completion_tokens": 5678
},
"generation_time": 1234567890
}
Error Response
{
"detail": "Error message here"
}
π Security
- β Input validation (Pydantic)
- β Prompt length limits (10-10000 chars)
- β Username validation (3-20 chars)
- β Email format validation
- β Error handling and logging
- β Request tracking
π Monitoring
Dashboard Metrics
- Uptime duration
- Total requests
- Error count
- CPU usage
- Memory usage
- API key usage
Health Endpoint
{
"status": "healthy",
"uptime_seconds": 12345,
"timestamp": "2026-01-15T10:30:00",
"requests": {
"total": 150,
"generate": 100,
"create": 45,
"errors": 5
}
}
π οΈ Development
Install Dependencies
pip install -r requirements.txt
Run Locally
uvicorn app:app --host 0.0.0.0 --port 7860 --reload
Deploy to HF Space
- Create new Space on Hugging Face
- Upload
app.pyandrequirements.txt - Set Space SDK to "Docker" or "Gradio"
- Space will auto-deploy
π¨βπ» Developer
Pratyush Srivastava
- GitHub: @pratyush
- Portfolio: pratyush.dev
π License
MIT License - Feel free to use and modify
π Version
2026.1.0 - Enhanced with uptime dashboard, external IP display, and comprehensive monitoring
Status: β Production Ready (Updated 2026-03-30)