diff --git a/backend/routes/allowlist.py b/backend/routes/allowlist.py index 02574ca505d..aa7493a2da4 100644 --- a/backend/routes/allowlist.py +++ b/backend/routes/allowlist.py @@ -63,6 +63,7 @@ BACKEND_PATH_PREFIXES: tuple[str, ...] = ( "/{mcp_server_name}/", # Budgets / tags / workflows / memory mgmt "/budget/", + "/ptu_reservation/", "/tag/", "/workflow/", "/v1/workflows/", diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20260713000000_add_litellm_ptu_reservation_table/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20260713000000_add_litellm_ptu_reservation_table/migration.sql index 4ece18e8857..f7f75967e14 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/migrations/20260713000000_add_litellm_ptu_reservation_table/migration.sql +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20260713000000_add_litellm_ptu_reservation_table/migration.sql @@ -12,7 +12,7 @@ CREATE TABLE IF NOT EXISTS "LiteLLM_PTUReservation" ( "created_by" TEXT NOT NULL, "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, "updated_by" TEXT NOT NULL, - "updated_at" TIMESTAMP(3) NOT NULL, + "updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, CONSTRAINT "LiteLLM_PTUReservation_pkey" PRIMARY KEY ("id") ); diff --git a/ui/litellm-dashboard/src/lib/http/schema.d.ts b/ui/litellm-dashboard/src/lib/http/schema.d.ts index 9f6d7410e77..aba3a85eb7c 100644 --- a/ui/litellm-dashboard/src/lib/http/schema.d.ts +++ b/ui/litellm-dashboard/src/lib/http/schema.d.ts @@ -10670,6 +10670,108 @@ export interface paths { patch?: never; trace?: never; }; + "/ptu_reservation/close": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * Close Ptu Reservation + * @description Close a reservation by setting effective_to. + * + * Parameters: + * - id (str, required) + * - effective_to (datetime, optional): defaults to now UTC + */ + post: operations["close_ptu_reservation_ptu_reservation_close_post"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/ptu_reservation/info": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * Info Ptu Reservation + * @description Get a single reservation by id. + * + * Query parameter: + * - id (str, required) + */ + get: operations["info_ptu_reservation_ptu_reservation_info_get"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/ptu_reservation/list": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * List Ptu Reservations + * @description List PTU reservations. + * + * Query parameters: + * - team_id (optional): filter by team + * - model (optional): filter by model + * - active_only (optional, default false): only reservations live right now + */ + get: operations["list_ptu_reservations_ptu_reservation_list_get"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/ptu_reservation/new": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * New Ptu Reservation + * @description Create a new PTU reservation for a (team, model) pair. + * + * Parameters: + * - team_id (str, required) + * - model (str, required) + * - cost_source (str): "manual" (default). "azure_billing" is reserved. + * - ptu_count (int): required for cost_source="manual", positive + * - cost_per_ptu (float): required for cost_source="manual", non-negative USD/month + * - azure_resource_id (str): reserved; must be null for manual + * - effective_from (datetime, required): inclusive UTC start + * - effective_to (datetime, optional): exclusive UTC end; null = still active + */ + post: operations["new_ptu_reservation_ptu_reservation_new_post"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; "/public/agent_hub": { parameters: { query?: never; @@ -28602,6 +28704,71 @@ export interface components { /** Organizations */ organizations: string[]; }; + /** + * PTUReservationCloseRequest + * @description Body accepted by POST /ptu_reservation/close. + */ + PTUReservationCloseRequest: { + /** + * Effective To + * @description Timestamp to set as effective_to. Defaults to now (UTC) if omitted. + */ + effective_to?: string | null; + /** + * Id + * @description Reservation id to close. + */ + id: string; + }; + /** + * PTUReservationNewRequest + * @description Body accepted by POST /ptu_reservation/new. + */ + PTUReservationNewRequest: { + /** + * Azure Resource Id + * @description Azure resource ARM id, for cost_source='azure_billing'. + */ + azure_resource_id?: string | null; + /** + * Cost Per Ptu + * @description Monthly cost per PTU in USD. Required for manual. + */ + cost_per_ptu?: number | null; + /** + * Cost Source + * @description Source of the cost figures. Only 'manual' is supported in this release. + * @default manual + * @enum {string} + */ + cost_source: "manual" | "azure_billing"; + /** + * Effective From + * Format: date-time + * @description Inclusive UTC start of the reservation. + */ + effective_from: string; + /** + * Effective To + * @description Exclusive UTC end of the reservation. Null = still active. + */ + effective_to?: string | null; + /** + * Model + * @description Model name the reservation covers. + */ + model: string; + /** + * Ptu Count + * @description Number of provisioned throughput units. Required for manual. + */ + ptu_count?: number | null; + /** + * Team Id + * @description Team that owns the reservation. + */ + team_id: string; + }; /** * PaginatedAuditLogResponse * @description Response model for paginated audit logs @@ -47116,6 +47283,136 @@ export interface operations { }; }; }; + close_ptu_reservation_ptu_reservation_close_post: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody: { + content: { + "application/json": components["schemas"]["PTUReservationCloseRequest"]; + }; + }; + responses: { + /** @description Successful Response */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": unknown; + }; + }; + /** @description Validation Error */ + 422: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["HTTPValidationError"]; + }; + }; + }; + }; + info_ptu_reservation_ptu_reservation_info_get: { + parameters: { + query: { + id: string; + }; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Successful Response */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": unknown; + }; + }; + /** @description Validation Error */ + 422: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["HTTPValidationError"]; + }; + }; + }; + }; + list_ptu_reservations_ptu_reservation_list_get: { + parameters: { + query?: { + team_id?: string | null; + model?: string | null; + active_only?: boolean; + }; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Successful Response */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": unknown; + }; + }; + /** @description Validation Error */ + 422: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["HTTPValidationError"]; + }; + }; + }; + }; + new_ptu_reservation_ptu_reservation_new_post: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody: { + content: { + "application/json": components["schemas"]["PTUReservationNewRequest"]; + }; + }; + responses: { + /** @description Successful Response */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": unknown; + }; + }; + /** @description Validation Error */ + 422: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["HTTPValidationError"]; + }; + }; + }; + }; get_agents_public_agent_hub_get: { parameters: { query?: never;