MCPcopy Create free account
hub / github.com/CJackHwang/AIstudioProxyAPI / create_app

Function create_app

api_utils/app.py:402–454  ·  view source on GitHub ↗

Create FastAPI application instance

()

Source from the content-addressed store, hash-verified

400
401
402def create_app() -> FastAPI:
403 """Create FastAPI application instance"""
404 app = FastAPI(
405 title="AI Studio Proxy Server (Integrated Mode)",
406 description="Proxy server interacting with AI Studio via Playwright.",
407 version=VERSION,
408 lifespan=lifespan,
409 )
410 app.add_middleware(APIKeyAuthMiddleware)
411 from fastapi.responses import FileResponse
412
413 from .routers import (
414 add_api_key,
415 auth_files_router,
416 cancel_request,
417 chat_completions,
418 delete_api_key,
419 get_api_info,
420 get_api_keys,
421 get_queue_status,
422 health_check,
423 list_models,
424 model_capabilities_router,
425 ports_router,
426 proxy_router,
427 read_index,
428 serve_react_assets,
429 test_api_key,
430 websocket_log_endpoint,
431 )
432
433 app.get("/", response_class=FileResponse)(read_index)
434 app.get("/assets/{filename:path}")(serve_react_assets)
435 app.get("/api/info")(get_api_info)
436 app.get("/health")(health_check)
437 app.get("/v1/models")(list_models)
438 app.post("/v1/chat/completions")(chat_completions)
439 app.post("/v1/cancel/{req_id}")(cancel_request)
440 app.get("/v1/queue")(get_queue_status)
441 app.websocket("/ws/logs")(websocket_log_endpoint)
442 app.include_router(model_capabilities_router)
443 app.include_router(proxy_router)
444 app.include_router(auth_files_router)
445 app.include_router(ports_router)
446 from api_utils.routers import helper_router, server_router
447
448 app.include_router(server_router)
449 app.include_router(helper_router)
450 app.get("/api/keys")(get_api_keys)
451 app.post("/api/keys")(add_api_key)
452 app.post("/api/keys/test")(test_api_key)
453 app.delete("/api/keys")(delete_api_key)
454 return app

Callers 4

server.pyFile · 0.90
test_app_creationMethod · 0.90
appFunction · 0.90

Calls 1

getMethod · 0.45

Tested by 3

test_app_creationMethod · 0.72
appFunction · 0.72