Spaces:
Paused
Paused
| from fastapi import FastAPI | |
| from litellm.proxy.proxy_server import ProxyServer | |
| from litellm.proxy.config import ProxyConfig | |
| app = FastAPI( | |
| title="LiteLLM Proxy", | |
| description="LiteLLM OpenAI-compatible proxy", | |
| version="1.0", | |
| docs_url="/proxy/docs", # Swagger UI | |
| redoc_url="/proxy/redoc", # Optional: ReDoc UI | |
| openapi_url="/proxy/openapi.json" | |
| ) | |
| # Load LiteLLM Proxy | |
| proxy_config = ProxyConfig() | |
| proxy_server = ProxyServer(config=proxy_config) | |
| proxy_server.add_routes(app) | |
| async def root(): | |
| return {"message": "LiteLLM is running. Visit /proxy/docs"} | |
| if __name__ == "__main__": | |
| import uvicorn | |
| uvicorn.run(app, host="0.0.0.0", port=7860) | |