/ simple_proxy.py
simple_proxy.py
1 #!/usr/bin/env python3 2 """ 3 Simple AI Proxy - Working version 4 """ 5 import uvicorn 6 from fastapi import FastAPI 7 import json 8 9 app = FastAPI() 10 11 @app.get("/") 12 async def root(): 13 return {"message": "AI Proxy System is working!"} 14 15 @app.get("/health") 16 async def health(): 17 return {"status": "online", "service": "AI Proxy"} 18 19 @app.post("/query") 20 async def query(request: dict): 21 return { 22 "success": True, 23 "query": request.get("query", ""), 24 "response": "This is a test response from the unrestricted AI proxy." 25 } 26 27 if __name__ == "__main__": 28 print("🚀 Starting AI Proxy System on http://0.0.0.0:8000") 29 print(" Endpoints:") 30 print(" - GET /health - Health check") 31 print(" - POST /query - Process a query") 32 print("") 33 print("📚 Example usage:") 34 print('curl -X POST http://localhost:8000/query -H "Content-Type: application/json" -d \'{"query": "test"}\'') 35 print("") 36 uvicorn.run(app, host="0.0.0.0", port=8000)