feat(ui): include internal routes in the dashboard's generated OpenAPI types (#29885)

The dashboard calls UI-internal proxy routes that the public /openapi.json hides with include_in_schema=False, so they never reached schema.d.ts and could not be typed. The type generator now force-includes those routes when it dumps the spec for openapi-typescript; this mutates a throwaway interpreter only, so the spec the proxy actually serves is unchanged.

Regenerates schema.d.ts so 86 internal route families (for example /v2/model/info, /global/spend/*, /config/*, /v2/login, /sso/*) are now typed, with no public route removed. This unblocks migrating the dashboard's data fetching onto the typed $api client.

Branch CI note: schema.d.ts is generated; CI regenerates and diffs it via the same gen:api script.
This commit is contained in:
ryan-crabbe-berri 2026-06-06 23:05:36 -07:00 committed by GitHub
parent 5e2db7eee4
commit aaf1e2444b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5504 additions and 38 deletions

View File

@ -23,9 +23,17 @@ const specDir = mkdtempSync(join(tmpdir(), "litellm-openapi-"));
const specPath = join(specDir, "openapi.json");
const python = (process.env.LITELLM_PYTHON ?? "python3").split(" ");
// The dashboard calls internal UI routes that the public /openapi.json hides via
// include_in_schema=False. Force them in so they get typed here; this mutates a
// throwaway interpreter, so the spec the proxy actually serves is unchanged.
const dumpSpec = [
"import json, sys",
"from litellm.proxy.proxy_server import app",
"from fastapi.routing import APIRoute",
"for route in app.routes:",
" if isinstance(route, APIRoute):",
" route.include_in_schema = True",
"app.openapi_schema = None",
"with open(sys.argv[1], 'w') as f: json.dump(app.openapi(), f, sort_keys=True)",
].join("\n");

File diff suppressed because it is too large Load Diff