Spaces:
Running
Running
Wimmboo commited on
Commit ·
7abc37b
1
Parent(s): b27b340
remove APIRouter prefix, hardcode paths
Browse files- proxy/router.py +5 -5
proxy/router.py
CHANGED
|
@@ -13,7 +13,7 @@ from proxy.providers import PROVIDERS
|
|
| 13 |
|
| 14 |
logger = logging.getLogger(__name__)
|
| 15 |
|
| 16 |
-
api = APIRouter(
|
| 17 |
|
| 18 |
|
| 19 |
MODELS = {
|
|
@@ -36,7 +36,7 @@ MODELS = {
|
|
| 36 |
}
|
| 37 |
|
| 38 |
|
| 39 |
-
@api.get("/models")
|
| 40 |
async def list_models() -> JSONResponse:
|
| 41 |
data = {
|
| 42 |
"object": "list",
|
|
@@ -53,7 +53,7 @@ async def list_models() -> JSONResponse:
|
|
| 53 |
return JSONResponse(content=data)
|
| 54 |
|
| 55 |
|
| 56 |
-
@api.post("/chat/completions")
|
| 57 |
async def chat_completions(request: Request) -> Response:
|
| 58 |
provider = resolve_provider(request)
|
| 59 |
real_key = get_real_key(provider)
|
|
@@ -80,12 +80,12 @@ async def chat_completions(request: Request) -> Response:
|
|
| 80 |
)
|
| 81 |
|
| 82 |
|
| 83 |
-
@api.get("/health")
|
| 84 |
async def health() -> JSONResponse:
|
| 85 |
return JSONResponse({"status": "ok", "providers": list(PROVIDERS.keys())})
|
| 86 |
|
| 87 |
|
| 88 |
-
@api.get("/keys")
|
| 89 |
async def proxy_keys() -> JSONResponse:
|
| 90 |
masked = {}
|
| 91 |
for name, key in PROVIDER_KEYS.items():
|
|
|
|
| 13 |
|
| 14 |
logger = logging.getLogger(__name__)
|
| 15 |
|
| 16 |
+
api = APIRouter()
|
| 17 |
|
| 18 |
|
| 19 |
MODELS = {
|
|
|
|
| 36 |
}
|
| 37 |
|
| 38 |
|
| 39 |
+
@api.get("/v1/models")
|
| 40 |
async def list_models() -> JSONResponse:
|
| 41 |
data = {
|
| 42 |
"object": "list",
|
|
|
|
| 53 |
return JSONResponse(content=data)
|
| 54 |
|
| 55 |
|
| 56 |
+
@api.post("/v1/chat/completions")
|
| 57 |
async def chat_completions(request: Request) -> Response:
|
| 58 |
provider = resolve_provider(request)
|
| 59 |
real_key = get_real_key(provider)
|
|
|
|
| 80 |
)
|
| 81 |
|
| 82 |
|
| 83 |
+
@api.get("/v1/health")
|
| 84 |
async def health() -> JSONResponse:
|
| 85 |
return JSONResponse({"status": "ok", "providers": list(PROVIDERS.keys())})
|
| 86 |
|
| 87 |
|
| 88 |
+
@api.get("/v1/keys")
|
| 89 |
async def proxy_keys() -> JSONResponse:
|
| 90 |
masked = {}
|
| 91 |
for name, key in PROVIDER_KEYS.items():
|