Spaces:
Sleeping
Sleeping
File size: 799 Bytes
ef7bcea 8744ae8 ef7bcea 8744ae8 ef7bcea |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
from fastapi import FastAPI
from fastapi.staticfiles import StaticFiles
from fastapi.middleware.cors import CORSMiddleware
from litellm.proxy.proxy_server import app as proxy_app
app = FastAPI(
title="LiteLLM API",
version="1.0.0",
docs_url="/", # Serve Swagger UI at root
)
# Add CORS middleware
app.add_middleware(
CORSMiddleware,
allow_origins=["*"],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
# Mount static files
app.mount("/swagger", StaticFiles(directory="swagger"), name="swagger")
# Mount the LiteLLM Proxy server at /proxy path
app.mount("/proxy", proxy_app)
@app.get("/health")
def health_check():
return {"status": "healthy"}
if __name__ == "__main__":
import uvicorn
uvicorn.run(app, host="0.0.0.0", port=7860) |