{
    "openapi": "3.1.0",
    "info": {
        "title": "LiteGen API",
        "description": "Universal proxy for AI image and video generation.",
        "license": {
            "name": "MIT",
            "identifier": "MIT"
        },
        "version": "0.1.0"
    },
    "paths": {
        "/health": {
            "get": {
                "tags": [
                    "System"
                ],
                "summary": "GET /health \u2014 Health check for all providers.",
                "operationId": "health_check",
                "responses": {
                    "200": {
                        "description": "Health check results",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/HealthResponse"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/health/live": {
            "get": {
                "tags": [
                    "System"
                ],
                "summary": "GET /health/live \u2014 Simple liveness probe.",
                "operationId": "liveness",
                "responses": {
                    "200": {
                        "description": "Liveness probe",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/LivenessResponse"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/v1/account": {
            "get": {
                "tags": [
                    "Account"
                ],
                "summary": "GET /v1/account \u2014 Get the current user's profile.",
                "operationId": "get_account",
                "responses": {
                    "200": {
                        "description": "Current user profile",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/AccountUser"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Not authenticated",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    }
                }
            },
            "patch": {
                "tags": [
                    "Account"
                ],
                "summary": "PATCH /v1/account \u2014 Update the current user's account (e.g. change password).",
                "operationId": "patch_account",
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/PatchAccountRequest"
                            }
                        }
                    },
                    "required": true
                },
                "responses": {
                    "200": {
                        "description": "Updated profile",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/AccountUser"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Bad request (no changes or missing fields)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Not authenticated or wrong password",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/v1/account/sessions": {
            "get": {
                "tags": [
                    "Account"
                ],
                "summary": "GET /v1/account/sessions \u2014 List the current user's active sessions.",
                "operationId": "list_sessions",
                "responses": {
                    "200": {
                        "description": "List of active sessions",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "array",
                                    "items": {
                                        "$ref": "#/components/schemas/SessionInfo"
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Not authenticated",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/v1/account/sessions/{id}": {
            "delete": {
                "tags": [
                    "Account"
                ],
                "summary": "DELETE /v1/account/sessions/{id} \u2014 Revoke one of the current user's sessions.",
                "operationId": "revoke_session",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "description": "Session ID to revoke",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "204": {
                        "description": "Session revoked"
                    },
                    "403": {
                        "description": "Cannot revoke another user's session",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Session not found",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/v1/apps/{app_id}": {
            "get": {
                "tags": [
                    "Applications"
                ],
                "summary": "GET /v1/apps/{app_id} \u2014 Get an application; authorizes via its org (app:read).",
                "operationId": "get_app",
                "parameters": [
                    {
                        "name": "app_id",
                        "in": "path",
                        "description": "Application ID",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Application",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Application"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Not found",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    }
                }
            },
            "delete": {
                "tags": [
                    "Applications"
                ],
                "summary": "DELETE /v1/apps/{app_id} \u2014 Delete an application (app:delete via its org).",
                "operationId": "delete_app",
                "parameters": [
                    {
                        "name": "app_id",
                        "in": "path",
                        "description": "Application ID",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "204": {
                        "description": "Deleted"
                    },
                    "403": {
                        "description": "Forbidden",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Not found",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    }
                }
            },
            "patch": {
                "tags": [
                    "Applications"
                ],
                "summary": "PATCH /v1/apps/{app_id} \u2014 Rename an application (app:write via its org).",
                "operationId": "patch_app",
                "parameters": [
                    {
                        "name": "app_id",
                        "in": "path",
                        "description": "Application ID",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/UpdateAppRequest"
                            }
                        }
                    },
                    "required": true
                },
                "responses": {
                    "200": {
                        "description": "Updated application",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Application"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Not found",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/v1/apps/{app_id}/provider-credentials": {
            "get": {
                "tags": [
                    "Applications"
                ],
                "summary": "GET /v1/apps/{app_id}/provider-credentials \u2014 List BYO credentials (provider_cred:read).\nNever returns plaintext \u2014 only `ProviderCredentialInfo`.",
                "operationId": "list_provider_credentials",
                "parameters": [
                    {
                        "name": "app_id",
                        "in": "path",
                        "description": "Application ID",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Stored credentials (no plaintext)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "array",
                                    "items": {
                                        "$ref": "#/components/schemas/ProviderCredentialInfo"
                                    }
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    }
                }
            },
            "post": {
                "tags": [
                    "Applications"
                ],
                "summary": "POST /v1/apps/{app_id}/provider-credentials \u2014 Store a BYO credential (provider_cred:write).\nEncrypts the credential JSON; returns `ProviderCredentialInfo` (no plaintext).",
                "operationId": "create_provider_credential",
                "parameters": [
                    {
                        "name": "app_id",
                        "in": "path",
                        "description": "Application ID",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/CreateProviderCredentialRequest"
                            }
                        }
                    },
                    "required": true
                },
                "responses": {
                    "200": {
                        "description": "Credential stored (no plaintext)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ProviderCredentialInfo"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Secrets key not configured",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/v1/apps/{app_id}/provider-credentials/{provider}": {
            "delete": {
                "tags": [
                    "Applications"
                ],
                "summary": "DELETE /v1/apps/{app_id}/provider-credentials/{provider} \u2014 Delete a credential (provider_cred:delete).",
                "operationId": "delete_provider_credential",
                "parameters": [
                    {
                        "name": "app_id",
                        "in": "path",
                        "description": "Application ID",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "provider",
                        "in": "path",
                        "description": "Provider name",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "204": {
                        "description": "Deleted"
                    },
                    "403": {
                        "description": "Forbidden",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Not found",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/v1/auth/config": {
            "get": {
                "tags": [
                    "Auth"
                ],
                "summary": "GET /v1/auth/config \u2014 Public auth-method discovery for the dashboard.",
                "operationId": "auth_config",
                "responses": {
                    "200": {
                        "description": "Enabled auth methods",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/AuthConfigResponse"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/v1/auth/csrf": {
            "get": {
                "tags": [
                    "Auth"
                ],
                "summary": "GET /v1/auth/csrf \u2014 Return the CSRF token for the current session.",
                "operationId": "csrf_token",
                "responses": {
                    "200": {
                        "description": "CSRF token",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/CsrfResponse"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Not authenticated",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/v1/auth/invitations/{token}": {
            "get": {
                "tags": [
                    "Users"
                ],
                "summary": "GET /v1/auth/invitations/{token} \u2014 Look up an invitation (no auth required).",
                "operationId": "get_invitation",
                "parameters": [
                    {
                        "name": "token",
                        "in": "path",
                        "description": "Invitation token",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Invitation details",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/InvitationView"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Expired or already used",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Not found",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/v1/auth/invitations/{token}/accept": {
            "post": {
                "tags": [
                    "Users"
                ],
                "summary": "POST /v1/auth/invitations/{token}/accept \u2014 Accept an invitation and create an account.",
                "operationId": "accept_invitation",
                "parameters": [
                    {
                        "name": "token",
                        "in": "path",
                        "description": "Invitation token",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/AcceptInvitationRequest"
                            }
                        }
                    },
                    "required": true
                },
                "responses": {
                    "200": {
                        "description": "Account created and session set"
                    },
                    "400": {
                        "description": "Invalid, expired, or already used",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Invitation not found",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/v1/auth/login": {
            "post": {
                "tags": [
                    "Auth"
                ],
                "summary": "POST /v1/auth/login \u2014 Log in with email and password.",
                "operationId": "login",
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/LoginRequest"
                            }
                        }
                    },
                    "required": true
                },
                "responses": {
                    "200": {
                        "description": "Logged in, session cookie set",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/AuthResponse"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Invalid credentials",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Too many failed attempts (locked out)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/v1/auth/logout": {
            "post": {
                "tags": [
                    "Auth"
                ],
                "summary": "POST /v1/auth/logout \u2014 Destroy the current session.",
                "operationId": "logout",
                "responses": {
                    "204": {
                        "description": "Logged out, session cookie cleared"
                    },
                    "401": {
                        "description": "Not authenticated",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/v1/auth/me": {
            "get": {
                "tags": [
                    "Auth"
                ],
                "summary": "GET /v1/auth/me \u2014 Return the currently authenticated user.",
                "operationId": "me",
                "responses": {
                    "200": {
                        "description": "Current user info"
                    },
                    "401": {
                        "description": "Not authenticated",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/v1/auth/oauth/github/callback": {
            "get": {
                "tags": [
                    "Auth"
                ],
                "summary": "GET /v1/auth/oauth/github/callback \u2014 Handle GitHub OAuth callback.",
                "operationId": "github_callback",
                "parameters": [
                    {
                        "name": "code",
                        "in": "query",
                        "description": "Authorization code from GitHub",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "state",
                        "in": "query",
                        "description": "State for CSRF verification",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "302": {
                        "description": "Redirect to app after successful auth"
                    },
                    "400": {
                        "description": "State mismatch or no verified email",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Account not found or inactive",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/v1/auth/oauth/github/start": {
            "get": {
                "tags": [
                    "Auth"
                ],
                "summary": "GET /v1/auth/oauth/github/start \u2014 Redirect to GitHub OAuth authorize page.",
                "operationId": "github_start",
                "responses": {
                    "302": {
                        "description": "Redirect to GitHub authorize page"
                    },
                    "404": {
                        "description": "GitHub OAuth not configured",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/v1/auth/oauth/google/callback": {
            "get": {
                "tags": [
                    "Auth"
                ],
                "summary": "GET /v1/auth/oauth/google/callback \u2014 Handle Google OAuth callback.",
                "operationId": "google_callback",
                "parameters": [
                    {
                        "name": "code",
                        "in": "query",
                        "description": "Authorization code from Google",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "state",
                        "in": "query",
                        "description": "State for CSRF verification",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "302": {
                        "description": "Redirect to app after successful auth"
                    },
                    "400": {
                        "description": "State mismatch or unverified email",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Account not found or inactive",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/v1/auth/oauth/google/start": {
            "get": {
                "tags": [
                    "Auth"
                ],
                "summary": "GET /v1/auth/oauth/google/start \u2014 Redirect to Google OAuth authorize page.",
                "operationId": "google_start",
                "responses": {
                    "302": {
                        "description": "Redirect to Google authorize page"
                    },
                    "404": {
                        "description": "Google OAuth not configured",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/v1/auth/password-reset/confirm": {
            "post": {
                "tags": [
                    "Auth"
                ],
                "summary": "POST /v1/auth/password-reset/confirm \u2014 Confirm a password reset with the token.",
                "operationId": "password_reset_confirm",
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/PasswordResetConfirmBody"
                            }
                        }
                    },
                    "required": true
                },
                "responses": {
                    "204": {
                        "description": "Password updated, all sessions revoked"
                    },
                    "400": {
                        "description": "Invalid or expired token",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/v1/auth/password-reset/request": {
            "post": {
                "tags": [
                    "Auth"
                ],
                "summary": "POST /v1/auth/password-reset/request \u2014 Request a password reset email.",
                "operationId": "password_reset_request",
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/PasswordResetRequestBody"
                            }
                        }
                    },
                    "required": true
                },
                "responses": {
                    "200": {
                        "description": "Request received (no enumeration; always 200)"
                    }
                }
            }
        },
        "/v1/auth/signup": {
            "post": {
                "tags": [
                    "Auth"
                ],
                "summary": "POST /v1/auth/signup \u2014 Create the first user (owner).",
                "operationId": "signup",
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/SignupRequest"
                            }
                        }
                    },
                    "required": true
                },
                "responses": {
                    "200": {
                        "description": "Signed up and session created",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/AuthResponse"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Bad request (short password)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Owner email mismatch",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "Signup closed (users already exist)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/v1/cache": {
            "delete": {
                "tags": [
                    "Admin"
                ],
                "summary": "DELETE /v1/cache \u2014 Clear the generation cache.",
                "operationId": "clear_cache",
                "responses": {
                    "200": {
                        "description": "Cache cleared",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/CacheClearedResponse"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/v1/images/cost": {
            "post": {
                "tags": [
                    "Images"
                ],
                "summary": "POST /v1/images/cost \u2014 Estimate cost for image generation.",
                "operationId": "estimate_image_cost",
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/ImageGenerationRequest"
                            }
                        }
                    },
                    "required": true
                },
                "responses": {
                    "200": {
                        "description": "Cost estimate",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/CostEstimate"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Bad request (validation failed)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/v1/images/generations": {
            "post": {
                "tags": [
                    "Images"
                ],
                "summary": "POST /v1/images/generations \u2014 Generate images (OpenAI-compatible).",
                "operationId": "generate_image",
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/ImageGenerationRequest"
                            }
                        }
                    },
                    "required": true
                },
                "responses": {
                    "200": {
                        "description": "Image generated successfully",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ImageGenerationResponse"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Bad request",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    },
                    "502": {
                        "description": "Provider error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/v1/keys": {
            "get": {
                "tags": [
                    "Admin"
                ],
                "summary": "GET /v1/keys \u2014 List API keys.",
                "operationId": "list_api_keys",
                "responses": {
                    "200": {
                        "description": "API keys",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiKeyListResponse"
                                }
                            }
                        }
                    }
                }
            },
            "post": {
                "tags": [
                    "Admin"
                ],
                "summary": "POST /v1/keys \u2014 Create a new API key.",
                "operationId": "create_api_key",
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/CreateApiKeyRequest"
                            }
                        }
                    },
                    "required": true
                },
                "responses": {
                    "201": {
                        "description": "API key created",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiKeyCreatedResponse"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/v1/keys/{id}": {
            "delete": {
                "tags": [
                    "Admin"
                ],
                "summary": "DELETE /v1/keys/:id \u2014 Revoke an API key.",
                "operationId": "revoke_api_key",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "description": "API key ID",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Key revoked",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/RevokeKeyResponse"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Key not found",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/v1/logs": {
            "get": {
                "tags": [
                    "Dashboard"
                ],
                "summary": "GET /v1/logs \u2014 Paginated + filtered request logs. Supports `?format=csv`.",
                "operationId": "get_logs_filtered",
                "parameters": [
                    {
                        "name": "page",
                        "in": "query",
                        "description": "Page number",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "format": "int32",
                            "minimum": 0
                        }
                    },
                    {
                        "name": "per_page",
                        "in": "query",
                        "description": "Items per page",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "format": "int32",
                            "minimum": 0
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Request logs",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/PaginatedResponse_RequestLog"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/v1/models": {
            "get": {
                "tags": [
                    "Models"
                ],
                "summary": "GET /v1/models \u2014 List all available models.",
                "operationId": "list_models",
                "responses": {
                    "200": {
                        "description": "List of available models",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ModelListResponse"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/v1/models/{id}": {
            "get": {
                "tags": [
                    "Models"
                ],
                "summary": "GET /v1/models/{id} \u2014 Full schema for one model.",
                "operationId": "get_model_schema",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "description": "Model ID (may contain slashes, e.g. 'openai/dall-e-3')",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Model schema",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ModelSchema"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Not found",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/v1/orgs": {
            "get": {
                "tags": [
                    "Organizations"
                ],
                "summary": "GET /v1/orgs \u2014 List the orgs the caller belongs to (any session user).",
                "operationId": "list_orgs",
                "responses": {
                    "200": {
                        "description": "Organizations the caller belongs to",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "array",
                                    "items": {
                                        "$ref": "#/components/schemas/OrgSummary"
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Session required",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    }
                }
            },
            "post": {
                "tags": [
                    "Organizations"
                ],
                "summary": "POST /v1/orgs \u2014 Create an organization owned by the caller (any session user).",
                "operationId": "create_org",
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/CreateOrgRequest"
                            }
                        }
                    },
                    "required": true
                },
                "responses": {
                    "200": {
                        "description": "Organization created",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/OrgView"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Session required",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "DB error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/v1/orgs/{id}": {
            "get": {
                "tags": [
                    "Organizations"
                ],
                "summary": "GET /v1/orgs/{id} \u2014 Get an organization (requires org:read membership).",
                "operationId": "get_org",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "description": "Organization ID",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Organization",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/OrgView"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Not found",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    }
                }
            },
            "delete": {
                "tags": [
                    "Organizations"
                ],
                "summary": "DELETE /v1/orgs/{id} \u2014 Delete an organization (requires org:delete membership).",
                "operationId": "delete_org",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "description": "Organization ID",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "204": {
                        "description": "Deleted"
                    },
                    "403": {
                        "description": "Forbidden",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Not found",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    }
                }
            },
            "patch": {
                "tags": [
                    "Organizations"
                ],
                "summary": "PATCH /v1/orgs/{id} \u2014 Rename an organization (requires org:write membership).",
                "operationId": "patch_org",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "description": "Organization ID",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/UpdateOrgRequest"
                            }
                        }
                    },
                    "required": true
                },
                "responses": {
                    "200": {
                        "description": "Updated organization",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/OrgView"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Not found",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/v1/orgs/{id}/apps": {
            "get": {
                "tags": [
                    "Applications"
                ],
                "summary": "GET /v1/orgs/{id}/apps \u2014 List applications in an org (requires app:read).",
                "operationId": "list_apps",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "description": "Organization ID",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Applications",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "array",
                                    "items": {
                                        "$ref": "#/components/schemas/Application"
                                    }
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    }
                }
            },
            "post": {
                "tags": [
                    "Applications"
                ],
                "summary": "POST /v1/orgs/{id}/apps \u2014 Create an application (requires app:write).",
                "operationId": "create_app",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "description": "Organization ID",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/CreateAppRequest"
                            }
                        }
                    },
                    "required": true
                },
                "responses": {
                    "200": {
                        "description": "Application created",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Application"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/v1/orgs/{id}/members": {
            "get": {
                "tags": [
                    "Organizations"
                ],
                "summary": "GET /v1/orgs/{id}/members \u2014 List org members (requires member:read membership).",
                "operationId": "list_members",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "description": "Organization ID",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Members",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "array",
                                    "items": {
                                        "$ref": "#/components/schemas/MemberView"
                                    }
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    }
                }
            },
            "post": {
                "tags": [
                    "Organizations"
                ],
                "summary": "POST /v1/orgs/{id}/members \u2014 Invite a member to this org (requires member:invite).",
                "operationId": "invite_member",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "description": "Organization ID",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/AddMemberRequest"
                            }
                        }
                    },
                    "required": true
                },
                "responses": {
                    "200": {
                        "description": "Invitation created"
                    },
                    "400": {
                        "description": "Cannot invite owner directly",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/v1/orgs/{id}/members/{user_id}": {
            "delete": {
                "tags": [
                    "Organizations"
                ],
                "summary": "DELETE /v1/orgs/{id}/members/{user_id} \u2014 Remove a member (requires member:remove).",
                "operationId": "remove_member",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "description": "Organization ID",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "user_id",
                        "in": "path",
                        "description": "Member user ID",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "204": {
                        "description": "Removed"
                    },
                    "400": {
                        "description": "Cannot remove owner",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Member not found",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    }
                }
            },
            "patch": {
                "tags": [
                    "Organizations"
                ],
                "summary": "PATCH /v1/orgs/{id}/members/{user_id} \u2014 Change a member's role (requires member:write).",
                "operationId": "patch_member",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "description": "Organization ID",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "user_id",
                        "in": "path",
                        "description": "Member user ID",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/UpdateMemberRequest"
                            }
                        }
                    },
                    "required": true
                },
                "responses": {
                    "200": {
                        "description": "Updated"
                    },
                    "400": {
                        "description": "Cannot change owner via this endpoint",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Member not found",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/v1/orgs/{id}/transfer-owner": {
            "post": {
                "tags": [
                    "Organizations"
                ],
                "summary": "POST /v1/orgs/{id}/transfer-owner \u2014 Transfer ownership (requires org:transfer_owner).",
                "operationId": "transfer_owner",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "description": "Organization ID",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/OrgTransferOwnerRequest"
                            }
                        }
                    },
                    "required": true
                },
                "responses": {
                    "204": {
                        "description": "Ownership transferred"
                    },
                    "403": {
                        "description": "Forbidden",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Target not a member",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/v1/stats": {
            "get": {
                "tags": [
                    "Dashboard"
                ],
                "summary": "GET /v1/stats \u2014 Get aggregate usage statistics.",
                "operationId": "get_stats",
                "responses": {
                    "200": {
                        "description": "Usage statistics",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ProxyStats"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/v1/users": {
            "get": {
                "tags": [
                    "Users"
                ],
                "summary": "GET /v1/users \u2014 List all users (requires user:read:any).",
                "operationId": "list_users",
                "responses": {
                    "200": {
                        "description": "List of users",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "array",
                                    "items": {
                                        "$ref": "#/components/schemas/PublicUser"
                                    }
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    }
                }
            },
            "post": {
                "tags": [
                    "Users"
                ],
                "summary": "POST /v1/users \u2014 Invite a user (requires invitation:send).",
                "operationId": "invite_user",
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/InviteRequest"
                            }
                        }
                    },
                    "required": true
                },
                "responses": {
                    "200": {
                        "description": "Invitation created",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/InviteResponse"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Bad request (e.g. owner role not allowed)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/v1/users/transfer-owner": {
            "post": {
                "tags": [
                    "Users"
                ],
                "summary": "POST /v1/users/transfer-owner \u2014 Transfer ownership to another user (Owner only).",
                "operationId": "transfer_owner",
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/TransferOwnerRequest"
                            }
                        }
                    },
                    "required": true
                },
                "responses": {
                    "204": {
                        "description": "Ownership transferred"
                    },
                    "403": {
                        "description": "Forbidden (not owner)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Target user not found",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/v1/users/{id}": {
            "delete": {
                "tags": [
                    "Users"
                ],
                "summary": "DELETE /v1/users/{id} \u2014 Soft-delete (deactivate) a user (requires user:delete:any).",
                "operationId": "delete_user",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "description": "User ID",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "204": {
                        "description": "User deactivated"
                    },
                    "400": {
                        "description": "Cannot delete owner",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "User not found",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    }
                }
            },
            "patch": {
                "tags": [
                    "Users"
                ],
                "summary": "PATCH /v1/users/{id} \u2014 Update user role or active status (requires user:write:any).",
                "operationId": "patch_user",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "description": "User ID",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/PatchUserRequest"
                            }
                        }
                    },
                    "required": true
                },
                "responses": {
                    "200": {
                        "description": "Updated user",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/PublicUser"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Bad request",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "User not found",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/v1/videos/cost": {
            "post": {
                "tags": [
                    "Videos"
                ],
                "summary": "POST /v1/videos/cost \u2014 Estimate cost for video generation.",
                "operationId": "estimate_video_cost",
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/VideoGenerationRequest"
                            }
                        }
                    },
                    "required": true
                },
                "responses": {
                    "200": {
                        "description": "Cost estimate",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/CostEstimate"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Bad request (validation failed)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/v1/videos/generations": {
            "post": {
                "tags": [
                    "Videos"
                ],
                "summary": "POST /v1/videos/generations \u2014 Start video generation.",
                "operationId": "generate_video",
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/VideoGenerationRequest"
                            }
                        }
                    },
                    "required": true
                },
                "responses": {
                    "200": {
                        "description": "Video generation started",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/VideoGenerationResponse"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Bad request",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/v1/videos/{id}": {
            "get": {
                "tags": [
                    "Videos"
                ],
                "summary": "GET /v1/videos/{id} \u2014 Poll the status of an in-flight video generation.",
                "operationId": "get_video_status",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "description": "Video generation ID",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Current status",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/VideoGenerationResponse"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Not found",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "AcceptInvitationRequest": {
                "type": "object",
                "properties": {
                    "password": {
                        "type": [
                            "string",
                            "null"
                        ]
                    }
                }
            },
            "AccountUser": {
                "type": "object",
                "description": "Public user view for account responses.",
                "required": [
                    "id",
                    "email",
                    "role",
                    "is_active",
                    "created_at"
                ],
                "properties": {
                    "created_at": {
                        "type": "string"
                    },
                    "email": {
                        "type": "string"
                    },
                    "id": {
                        "type": "string"
                    },
                    "is_active": {
                        "type": "boolean"
                    },
                    "last_login_at": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "role": {
                        "type": "string"
                    }
                }
            },
            "AddMemberRequest": {
                "type": "object",
                "required": [
                    "email",
                    "role"
                ],
                "properties": {
                    "email": {
                        "type": "string"
                    },
                    "role": {
                        "$ref": "#/components/schemas/Role"
                    }
                }
            },
            "ApiKey": {
                "type": "object",
                "description": "API key for authenticating with the LiteGen proxy.",
                "required": [
                    "id",
                    "name",
                    "key_hash",
                    "key_prefix",
                    "created_at",
                    "is_active",
                    "tokens_used",
                    "scopes"
                ],
                "properties": {
                    "app_id": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "created_at": {
                        "type": "string",
                        "format": "date-time"
                    },
                    "expires_at": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "id": {
                        "type": "string",
                        "format": "uuid"
                    },
                    "is_active": {
                        "type": "boolean"
                    },
                    "key_hash": {
                        "type": "string"
                    },
                    "key_prefix": {
                        "type": "string"
                    },
                    "name": {
                        "type": "string"
                    },
                    "org_id": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "owner_user_id": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "The user who owns this key (None for master-key-created keys)."
                    },
                    "public_id": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "Public key id shown to customers, e.g. \"pk_live_\u2026\". None for legacy lg- keys."
                    },
                    "rpm_limit": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "format": "int32",
                        "description": "Requests-per-minute cap; None = unlimited.",
                        "minimum": 0
                    },
                    "scopes": {
                        "type": "string",
                        "description": "CSV of scopes: \"generate,read,admin\"."
                    },
                    "token_quota": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "format": "double",
                        "description": "USD budget cap; None = unlimited."
                    },
                    "tokens_used": {
                        "type": "number",
                        "format": "double",
                        "description": "Running USD spent under this key."
                    },
                    "webhook_url": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "Webhook URL for async notifications (future use)."
                    }
                }
            },
            "ApiKeyCreatedResponse": {
                "type": "object",
                "description": "Response for `POST /v1/keys`.",
                "required": [
                    "id",
                    "key",
                    "prefix",
                    "public_id",
                    "name",
                    "created_at",
                    "scopes"
                ],
                "properties": {
                    "created_at": {
                        "type": "string",
                        "format": "date-time"
                    },
                    "id": {
                        "type": "string",
                        "format": "uuid"
                    },
                    "key": {
                        "type": "string"
                    },
                    "name": {
                        "type": "string"
                    },
                    "prefix": {
                        "type": "string"
                    },
                    "public_id": {
                        "type": "string"
                    },
                    "rpm_limit": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "format": "int32",
                        "minimum": 0
                    },
                    "scopes": {
                        "type": "string"
                    },
                    "token_quota": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "format": "double"
                    }
                }
            },
            "ApiKeyEntry": {
                "type": "object",
                "description": "An API key with weight for round-robin distribution.",
                "required": [
                    "key"
                ],
                "properties": {
                    "key": {
                        "type": "string",
                        "description": "The API key value. Stored encrypted at rest."
                    },
                    "label": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "Optional label for the key."
                    },
                    "weight": {
                        "type": "integer",
                        "format": "int32",
                        "description": "Weight for round-robin (higher = more traffic). Default: 1.",
                        "minimum": 0
                    }
                }
            },
            "ApiKeyInfo": {
                "type": "object",
                "description": "Public view of an API key (no hash).",
                "required": [
                    "id",
                    "name",
                    "prefix",
                    "created_at",
                    "is_active",
                    "tokens_used",
                    "scopes"
                ],
                "properties": {
                    "app_id": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "created_at": {
                        "type": "string",
                        "format": "date-time"
                    },
                    "expires_at": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "id": {
                        "type": "string",
                        "format": "uuid"
                    },
                    "is_active": {
                        "type": "boolean"
                    },
                    "name": {
                        "type": "string"
                    },
                    "prefix": {
                        "type": "string"
                    },
                    "public_id": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "rpm_limit": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "format": "int32",
                        "minimum": 0
                    },
                    "scopes": {
                        "type": "string"
                    },
                    "token_quota": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "format": "double"
                    },
                    "tokens_used": {
                        "type": "number",
                        "format": "double"
                    },
                    "webhook_url": {
                        "type": [
                            "string",
                            "null"
                        ]
                    }
                }
            },
            "ApiKeyListResponse": {
                "type": "object",
                "description": "Response for `GET /v1/keys`.",
                "required": [
                    "data"
                ],
                "properties": {
                    "data": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/ApiKeyInfo"
                        }
                    }
                }
            },
            "Application": {
                "type": "object",
                "required": [
                    "id",
                    "org_id",
                    "name",
                    "slug",
                    "status",
                    "created_at",
                    "updated_at"
                ],
                "properties": {
                    "created_at": {
                        "type": "string",
                        "format": "date-time"
                    },
                    "id": {
                        "type": "string"
                    },
                    "name": {
                        "type": "string"
                    },
                    "org_id": {
                        "type": "string"
                    },
                    "slug": {
                        "type": "string"
                    },
                    "status": {
                        "type": "string"
                    },
                    "updated_at": {
                        "type": "string",
                        "format": "date-time"
                    }
                }
            },
            "AuthConfigResponse": {
                "type": "object",
                "required": [
                    "password_enabled",
                    "providers_enabled",
                    "signup_open"
                ],
                "properties": {
                    "password_enabled": {
                        "type": "boolean",
                        "description": "Whether email/password signup + login is enabled."
                    },
                    "providers_enabled": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        },
                        "description": "OAuth providers with both CLIENT_ID and CLIENT_SECRET configured\n(e.g. `[\"github\", \"google\"]`)."
                    },
                    "signup_open": {
                        "type": "boolean",
                        "description": "Whether self-service signup is open (true in hosted mode)."
                    }
                }
            },
            "AuthResponse": {
                "type": "object",
                "required": [
                    "user"
                ],
                "properties": {
                    "user": {
                        "$ref": "#/components/schemas/PublicUser"
                    }
                }
            },
            "BaseGenerationRequest": {
                "type": "object",
                "required": [
                    "prompt",
                    "model"
                ],
                "properties": {
                    "extra": {},
                    "metadata": {},
                    "model": {
                        "type": "string"
                    },
                    "n": {
                        "type": "integer",
                        "format": "int32",
                        "minimum": 0
                    },
                    "negative_prompt": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "prompt": {
                        "type": "string"
                    },
                    "reference_images": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/ReferenceImage"
                        }
                    },
                    "seed": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "format": "int64"
                    },
                    "strict": {
                        "type": "boolean"
                    }
                }
            },
            "CacheClearedResponse": {
                "type": "object",
                "description": "Response for `DELETE /v1/cache`.",
                "required": [
                    "cleared"
                ],
                "properties": {
                    "cleared": {
                        "type": "boolean"
                    }
                }
            },
            "CacheConfig": {
                "type": "object",
                "properties": {
                    "enabled": {
                        "type": "boolean",
                        "description": "Enable caching for this model."
                    },
                    "max_items": {
                        "type": "integer",
                        "format": "int64",
                        "description": "Max cached items.",
                        "minimum": 0
                    },
                    "ttl_seconds": {
                        "type": "integer",
                        "format": "int64",
                        "description": "Cache TTL in seconds.",
                        "minimum": 0
                    }
                }
            },
            "CacheStatus": {
                "type": "object",
                "description": "Cache state included in the health response.",
                "required": [
                    "enabled",
                    "entries"
                ],
                "properties": {
                    "enabled": {
                        "type": "boolean"
                    },
                    "entries": {
                        "type": "integer",
                        "format": "int64",
                        "minimum": 0
                    }
                }
            },
            "CapabilityMediaType": {
                "type": "string",
                "enum": [
                    "image",
                    "video"
                ]
            },
            "CapabilityModelPricing": {
                "type": "object",
                "required": [
                    "base_cost_usd"
                ],
                "properties": {
                    "base_cost_usd": {
                        "type": "number",
                        "format": "double"
                    },
                    "variable_pricing": {}
                }
            },
            "CostEstimate": {
                "type": "object",
                "description": "Cost estimate returned before generation.",
                "required": [
                    "base_cost_usd",
                    "markup_usd",
                    "total_cost_usd",
                    "tokens_required",
                    "cost_source"
                ],
                "properties": {
                    "base_cost_usd": {
                        "type": "number",
                        "format": "double",
                        "description": "Base cost from the provider in USD."
                    },
                    "breakdown": {
                        "description": "Breakdown details."
                    },
                    "cost_source": {
                        "$ref": "#/components/schemas/CostSource",
                        "description": "Where the cost data came from."
                    },
                    "markup_usd": {
                        "type": "number",
                        "format": "double",
                        "description": "Markup applied (configurable, default 0%)."
                    },
                    "tokens_required": {
                        "type": "integer",
                        "format": "int64",
                        "description": "Equivalent token cost.",
                        "minimum": 0
                    },
                    "total_cost_usd": {
                        "type": "number",
                        "format": "double",
                        "description": "Total cost including markup."
                    }
                }
            },
            "CostSource": {
                "type": "string",
                "enum": [
                    "dynamic",
                    "estimated"
                ]
            },
            "CreateApiKeyRequest": {
                "type": "object",
                "required": [
                    "name"
                ],
                "properties": {
                    "name": {
                        "type": "string"
                    },
                    "rpm_limit": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "format": "int32",
                        "description": "Requests-per-minute cap; None = unlimited.",
                        "minimum": 0
                    },
                    "scopes": {
                        "type": "string",
                        "description": "CSV of scopes (default: \"generate,read\")."
                    },
                    "token_quota": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "format": "double",
                        "description": "USD budget cap; None = unlimited."
                    },
                    "webhook_url": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "Webhook URL for async callbacks."
                    }
                }
            },
            "CreateAppRequest": {
                "type": "object",
                "required": [
                    "name"
                ],
                "properties": {
                    "name": {
                        "type": "string"
                    }
                }
            },
            "CreateOrgRequest": {
                "type": "object",
                "required": [
                    "name"
                ],
                "properties": {
                    "name": {
                        "type": "string"
                    }
                }
            },
            "CreateProviderCredentialRequest": {
                "type": "object",
                "required": [
                    "provider",
                    "credentials"
                ],
                "properties": {
                    "credentials": {
                        "description": "The provider's secret fields, e.g. `{\"api_key\":\"sk-...\"}`."
                    },
                    "provider": {
                        "type": "string"
                    }
                }
            },
            "CsrfResponse": {
                "type": "object",
                "required": [
                    "csrf_token"
                ],
                "properties": {
                    "csrf_token": {
                        "type": "string"
                    }
                }
            },
            "Deployment": {
                "type": "object",
                "description": "A single deployment in a routing chain.",
                "required": [
                    "provider"
                ],
                "properties": {
                    "max_retries": {
                        "type": "integer",
                        "format": "int32",
                        "description": "Max retries before falling to next deployment.",
                        "minimum": 0
                    },
                    "provider": {
                        "type": "string",
                        "description": "Provider config name/id."
                    },
                    "respect_health": {
                        "type": "boolean",
                        "description": "Whether to skip this deployment on health check failure."
                    },
                    "rpm_limit": {
                        "type": "integer",
                        "format": "int32",
                        "description": "Rate limit (requests per minute). 0 = unlimited.",
                        "minimum": 0
                    },
                    "timeout_seconds": {
                        "type": "integer",
                        "format": "int64",
                        "description": "Timeout in seconds.",
                        "minimum": 0
                    },
                    "weight": {
                        "type": "integer",
                        "format": "int32",
                        "description": "Weight for weighted routing.",
                        "minimum": 0
                    }
                }
            },
            "ErrorDetail": {
                "type": "object",
                "required": [
                    "message",
                    "type"
                ],
                "properties": {
                    "code": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "message": {
                        "type": "string"
                    },
                    "provider_error": {},
                    "type": {
                        "type": "string"
                    }
                }
            },
            "ErrorResponse": {
                "type": "object",
                "required": [
                    "error"
                ],
                "properties": {
                    "error": {
                        "$ref": "#/components/schemas/ErrorDetail"
                    }
                }
            },
            "GenerationStatus": {
                "type": "string",
                "enum": [
                    "pending",
                    "processing",
                    "completed",
                    "failed",
                    "cancelled"
                ]
            },
            "HealthResponse": {
                "type": "object",
                "description": "Response for `GET /health`.",
                "required": [
                    "status",
                    "providers",
                    "cache"
                ],
                "properties": {
                    "cache": {
                        "$ref": "#/components/schemas/CacheStatus"
                    },
                    "providers": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/ProviderHealth"
                        }
                    },
                    "status": {
                        "type": "string"
                    }
                }
            },
            "ImageGenerationRequest": {
                "allOf": [
                    {
                        "$ref": "#/components/schemas/BaseGenerationRequest"
                    },
                    {
                        "type": "object",
                        "properties": {
                            "aspect_ratio": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            },
                            "guidance_scale": {
                                "type": [
                                    "number",
                                    "null"
                                ],
                                "format": "double"
                            },
                            "quality": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            },
                            "response_format": {
                                "type": "string"
                            },
                            "size": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            },
                            "steps": {
                                "type": [
                                    "integer",
                                    "null"
                                ],
                                "format": "int32",
                                "minimum": 0
                            },
                            "strength": {
                                "type": [
                                    "number",
                                    "null"
                                ],
                                "format": "double"
                            },
                            "style": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            }
                        }
                    }
                ]
            },
            "ImageGenerationResponse": {
                "type": "object",
                "description": "Response for an image generation request.\nFollows OpenAI's images response format for compatibility.",
                "required": [
                    "created",
                    "data",
                    "model",
                    "provider",
                    "id"
                ],
                "properties": {
                    "created": {
                        "type": "integer",
                        "format": "int64",
                        "description": "Unix timestamp of when the request was created."
                    },
                    "data": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/ImageResult"
                        },
                        "description": "Array of generated images."
                    },
                    "id": {
                        "type": "string",
                        "description": "Unique request ID for tracking."
                    },
                    "model": {
                        "type": "string",
                        "description": "The model that was used."
                    },
                    "provider": {
                        "type": "string",
                        "description": "The provider that handled the request."
                    },
                    "usage": {
                        "oneOf": [
                            {
                                "type": "null"
                            },
                            {
                                "$ref": "#/components/schemas/UsageInfo",
                                "description": "Cost information."
                            }
                        ]
                    }
                }
            },
            "ImageResult": {
                "type": "object",
                "description": "A single generated image in the response.",
                "required": [
                    "index"
                ],
                "properties": {
                    "b64_json": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "Base64-encoded image data (if response_format=b64_json)."
                    },
                    "content_type": {
                        "type": "string",
                        "description": "Content type of the image (e.g. \"image/png\")."
                    },
                    "index": {
                        "type": "integer",
                        "format": "int32",
                        "description": "Index in the batch.",
                        "minimum": 0
                    },
                    "revised_prompt": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "Revised prompt (if provider modified the prompt, e.g. DALL-E 3)."
                    },
                    "url": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "URL of the generated image (if response_format=url)."
                    }
                }
            },
            "Invitation": {
                "type": "object",
                "required": [
                    "id",
                    "email",
                    "role",
                    "token",
                    "org_id",
                    "expires_at",
                    "created_at"
                ],
                "properties": {
                    "created_at": {
                        "type": "string",
                        "format": "date-time"
                    },
                    "email": {
                        "type": "string"
                    },
                    "expires_at": {
                        "type": "string",
                        "format": "date-time"
                    },
                    "id": {
                        "type": "string"
                    },
                    "invited_by": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "org_id": {
                        "type": "string",
                        "description": "Organization the invitee will join on accept. Defaults to the\nsingle-tenant default org for legacy/global invites."
                    },
                    "role": {
                        "$ref": "#/components/schemas/Role",
                        "description": "The role the invited user will receive in `org_id` upon accepting."
                    },
                    "token": {
                        "type": "string"
                    },
                    "used_at": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    }
                }
            },
            "InvitationView": {
                "type": "object",
                "required": [
                    "email",
                    "role",
                    "expires_at"
                ],
                "properties": {
                    "email": {
                        "type": "string"
                    },
                    "expires_at": {
                        "type": "string"
                    },
                    "role": {
                        "type": "string"
                    }
                }
            },
            "InviteRequest": {
                "type": "object",
                "required": [
                    "email",
                    "role"
                ],
                "properties": {
                    "email": {
                        "type": "string"
                    },
                    "role": {
                        "$ref": "#/components/schemas/Role"
                    }
                }
            },
            "InviteResponse": {
                "type": "object",
                "required": [
                    "id",
                    "email",
                    "role",
                    "expires_at"
                ],
                "properties": {
                    "email": {
                        "type": "string"
                    },
                    "expires_at": {
                        "type": "string"
                    },
                    "id": {
                        "type": "string"
                    },
                    "role": {
                        "type": "string"
                    }
                }
            },
            "LatencyPercentiles": {
                "type": "object",
                "description": "Latency percentiles for the last N minutes.",
                "required": [
                    "p50_ms",
                    "p95_ms",
                    "p99_ms",
                    "sample_count",
                    "window_minutes"
                ],
                "properties": {
                    "p50_ms": {
                        "type": "number",
                        "format": "double"
                    },
                    "p95_ms": {
                        "type": "number",
                        "format": "double"
                    },
                    "p99_ms": {
                        "type": "number",
                        "format": "double"
                    },
                    "sample_count": {
                        "type": "integer",
                        "format": "int64",
                        "minimum": 0
                    },
                    "window_minutes": {
                        "type": "integer",
                        "format": "int64"
                    }
                }
            },
            "LivenessResponse": {
                "type": "object",
                "description": "Response for `GET /health/live`.",
                "required": [
                    "status"
                ],
                "properties": {
                    "status": {
                        "type": "string"
                    }
                }
            },
            "LoginRequest": {
                "type": "object",
                "required": [
                    "email",
                    "password"
                ],
                "properties": {
                    "email": {
                        "type": "string"
                    },
                    "password": {
                        "type": "string"
                    }
                }
            },
            "MediaType": {
                "type": "string",
                "enum": [
                    "image",
                    "video"
                ]
            },
            "MemberView": {
                "type": "object",
                "required": [
                    "org_id",
                    "user_id",
                    "email",
                    "role",
                    "created_at"
                ],
                "properties": {
                    "created_at": {
                        "type": "string"
                    },
                    "email": {
                        "type": "string"
                    },
                    "org_id": {
                        "type": "string"
                    },
                    "role": {
                        "type": "string"
                    },
                    "user_id": {
                        "type": "string"
                    }
                }
            },
            "ModelCapabilities": {
                "type": "object",
                "required": [
                    "supports_text_to_image",
                    "supports_image_to_image"
                ],
                "properties": {
                    "max_duration_seconds": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "format": "double"
                    },
                    "max_images": {
                        "type": "integer",
                        "format": "int32",
                        "minimum": 0
                    },
                    "supported_sizes": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        }
                    },
                    "supports_first_frame": {
                        "type": "boolean"
                    },
                    "supports_image_to_image": {
                        "type": "boolean"
                    },
                    "supports_image_to_video": {
                        "type": "boolean"
                    },
                    "supports_inpainting": {
                        "type": "boolean"
                    },
                    "supports_last_frame": {
                        "type": "boolean"
                    },
                    "supports_text_to_image": {
                        "type": "boolean"
                    },
                    "supports_text_to_video": {
                        "type": "boolean"
                    }
                }
            },
            "ModelCapabilityFlags": {
                "type": "object",
                "properties": {
                    "image_to_image": {
                        "type": "boolean"
                    },
                    "image_to_video": {
                        "type": "boolean"
                    },
                    "inpainting": {
                        "type": "boolean"
                    },
                    "text_to_image": {
                        "type": "boolean"
                    },
                    "text_to_video": {
                        "type": "boolean"
                    }
                }
            },
            "ModelInfo": {
                "type": "object",
                "description": "A model available through LiteGen.",
                "required": [
                    "id",
                    "name",
                    "provider",
                    "media_type",
                    "is_available",
                    "capabilities"
                ],
                "properties": {
                    "capabilities": {
                        "$ref": "#/components/schemas/ModelCapabilities",
                        "description": "Model capabilities."
                    },
                    "description": {
                        "type": "string",
                        "description": "Description."
                    },
                    "id": {
                        "type": "string",
                        "description": "Unique model ID (e.g. \"openai/dall-e-3\")."
                    },
                    "is_available": {
                        "type": "boolean",
                        "description": "Whether the model is currently available."
                    },
                    "media_type": {
                        "$ref": "#/components/schemas/MediaType",
                        "description": "Media type this model produces."
                    },
                    "name": {
                        "type": "string",
                        "description": "Human-readable name."
                    },
                    "pricing": {
                        "oneOf": [
                            {
                                "type": "null"
                            },
                            {
                                "$ref": "#/components/schemas/ModelPricing",
                                "description": "Pricing information."
                            }
                        ]
                    },
                    "provider": {
                        "type": "string",
                        "description": "Provider name."
                    },
                    "tags": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        },
                        "description": "Tags for filtering."
                    }
                }
            },
            "ModelListResponse": {
                "type": "object",
                "description": "Response for `GET /v1/models`.",
                "required": [
                    "object",
                    "data"
                ],
                "properties": {
                    "data": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/ModelInfo"
                        }
                    },
                    "object": {
                        "type": "string"
                    }
                }
            },
            "ModelPricing": {
                "type": "object",
                "required": [
                    "base_cost_usd"
                ],
                "properties": {
                    "base_cost_usd": {
                        "type": "number",
                        "format": "double",
                        "description": "Base cost per image/video in USD."
                    },
                    "variable_pricing": {
                        "description": "Variable pricing by dimension (JSON map)."
                    }
                }
            },
            "ModelRoute": {
                "type": "object",
                "description": "Routing configuration for a model, with fallbacks and weights.",
                "required": [
                    "model",
                    "deployments"
                ],
                "properties": {
                    "cache": {
                        "oneOf": [
                            {
                                "type": "null"
                            },
                            {
                                "$ref": "#/components/schemas/CacheConfig",
                                "description": "Cache settings for this model."
                            }
                        ]
                    },
                    "deployments": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/Deployment"
                        },
                        "description": "Ordered list of provider deployments to try."
                    },
                    "model": {
                        "type": "string",
                        "description": "The model ID pattern (e.g. \"dall-e-3\", \"openai/*\")."
                    },
                    "strategy": {
                        "$ref": "#/components/schemas/RoutingStrategy",
                        "description": "Routing strategy."
                    }
                }
            },
            "ModelSchema": {
                "type": "object",
                "required": [
                    "id",
                    "provider",
                    "media_type",
                    "display_name",
                    "pricing",
                    "capabilities",
                    "prompt"
                ],
                "properties": {
                    "capabilities": {
                        "$ref": "#/components/schemas/ModelCapabilityFlags"
                    },
                    "description": {
                        "type": "string"
                    },
                    "display_name": {
                        "type": "string"
                    },
                    "extra_allowlist": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        }
                    },
                    "id": {
                        "type": "string"
                    },
                    "media_type": {
                        "$ref": "#/components/schemas/CapabilityMediaType"
                    },
                    "params": {
                        "type": "object",
                        "additionalProperties": {},
                        "propertyNames": {
                            "type": "string"
                        }
                    },
                    "pricing": {
                        "$ref": "#/components/schemas/CapabilityModelPricing"
                    },
                    "prompt": {
                        "$ref": "#/components/schemas/PromptSpec"
                    },
                    "provider": {
                        "type": "string"
                    },
                    "ref_inputs": {
                        "oneOf": [
                            {
                                "type": "null"
                            },
                            {
                                "$ref": "#/components/schemas/RefInputSpec"
                            }
                        ]
                    },
                    "tags": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        }
                    }
                }
            },
            "ModelUsageStat": {
                "type": "object",
                "required": [
                    "model",
                    "requests",
                    "cost_usd",
                    "avg_latency_ms"
                ],
                "properties": {
                    "avg_latency_ms": {
                        "type": "number",
                        "format": "double"
                    },
                    "cost_usd": {
                        "type": "number",
                        "format": "double"
                    },
                    "model": {
                        "type": "string"
                    },
                    "requests": {
                        "type": "integer",
                        "format": "int64",
                        "minimum": 0
                    }
                }
            },
            "OrgSummary": {
                "type": "object",
                "required": [
                    "id",
                    "name",
                    "slug",
                    "role"
                ],
                "properties": {
                    "id": {
                        "type": "string"
                    },
                    "name": {
                        "type": "string"
                    },
                    "role": {
                        "type": "string"
                    },
                    "slug": {
                        "type": "string"
                    }
                }
            },
            "OrgTransferOwnerRequest": {
                "type": "object",
                "description": "Renamed in the OpenAPI schema to `OrgTransferOwnerRequest` to avoid a\ncomponent name collision with `users::TransferOwnerRequest`.",
                "required": [
                    "new_owner_user_id"
                ],
                "properties": {
                    "new_owner_user_id": {
                        "type": "string"
                    }
                }
            },
            "OrgView": {
                "type": "object",
                "required": [
                    "id",
                    "name",
                    "slug",
                    "plan",
                    "status"
                ],
                "properties": {
                    "id": {
                        "type": "string"
                    },
                    "name": {
                        "type": "string"
                    },
                    "plan": {
                        "type": "string"
                    },
                    "slug": {
                        "type": "string"
                    },
                    "status": {
                        "type": "string"
                    }
                }
            },
            "Organization": {
                "type": "object",
                "required": [
                    "id",
                    "name",
                    "slug",
                    "plan",
                    "status",
                    "created_at",
                    "updated_at"
                ],
                "properties": {
                    "created_at": {
                        "type": "string",
                        "format": "date-time"
                    },
                    "id": {
                        "type": "string"
                    },
                    "name": {
                        "type": "string"
                    },
                    "plan": {
                        "type": "string"
                    },
                    "slug": {
                        "type": "string"
                    },
                    "status": {
                        "type": "string"
                    },
                    "updated_at": {
                        "type": "string",
                        "format": "date-time"
                    }
                }
            },
            "OrganizationMember": {
                "type": "object",
                "required": [
                    "org_id",
                    "user_id",
                    "email",
                    "role",
                    "created_at"
                ],
                "properties": {
                    "created_at": {
                        "type": "string",
                        "format": "date-time"
                    },
                    "email": {
                        "type": "string"
                    },
                    "org_id": {
                        "type": "string"
                    },
                    "role": {
                        "$ref": "#/components/schemas/Role"
                    },
                    "user_id": {
                        "type": "string"
                    }
                }
            },
            "PaginatedResponse_RequestLog": {
                "type": "object",
                "required": [
                    "data",
                    "total",
                    "page",
                    "per_page",
                    "total_pages"
                ],
                "properties": {
                    "data": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "required": [
                                "id",
                                "model",
                                "provider",
                                "status",
                                "media_type",
                                "cost_usd",
                                "latency_ms",
                                "created_at"
                            ],
                            "properties": {
                                "cost_usd": {
                                    "type": "number",
                                    "format": "double"
                                },
                                "created_at": {
                                    "type": "string",
                                    "format": "date-time"
                                },
                                "error": {
                                    "type": [
                                        "string",
                                        "null"
                                    ]
                                },
                                "id": {
                                    "type": "string"
                                },
                                "latency_ms": {
                                    "type": "integer",
                                    "format": "int64",
                                    "minimum": 0
                                },
                                "media_type": {
                                    "$ref": "#/components/schemas/MediaType"
                                },
                                "metadata": {},
                                "model": {
                                    "type": "string"
                                },
                                "provider": {
                                    "type": "string"
                                },
                                "status": {
                                    "$ref": "#/components/schemas/GenerationStatus"
                                }
                            }
                        }
                    },
                    "page": {
                        "type": "integer",
                        "format": "int32",
                        "minimum": 0
                    },
                    "per_page": {
                        "type": "integer",
                        "format": "int32",
                        "minimum": 0
                    },
                    "total": {
                        "type": "integer",
                        "format": "int64",
                        "minimum": 0
                    },
                    "total_pages": {
                        "type": "integer",
                        "format": "int32",
                        "minimum": 0
                    }
                }
            },
            "ParamSpec": {
                "oneOf": [
                    {
                        "allOf": [
                            {
                                "$ref": "#/components/schemas/ParamSpecBool"
                            },
                            {
                                "type": "object",
                                "required": [
                                    "kind"
                                ],
                                "properties": {
                                    "kind": {
                                        "type": "string",
                                        "enum": [
                                            "bool"
                                        ]
                                    }
                                }
                            }
                        ]
                    },
                    {
                        "allOf": [
                            {
                                "$ref": "#/components/schemas/ParamSpecInt"
                            },
                            {
                                "type": "object",
                                "required": [
                                    "kind"
                                ],
                                "properties": {
                                    "kind": {
                                        "type": "string",
                                        "enum": [
                                            "int"
                                        ]
                                    }
                                }
                            }
                        ]
                    },
                    {
                        "allOf": [
                            {
                                "$ref": "#/components/schemas/ParamSpecFloat"
                            },
                            {
                                "type": "object",
                                "required": [
                                    "kind"
                                ],
                                "properties": {
                                    "kind": {
                                        "type": "string",
                                        "enum": [
                                            "float"
                                        ]
                                    }
                                }
                            }
                        ]
                    },
                    {
                        "allOf": [
                            {
                                "$ref": "#/components/schemas/ParamSpecString"
                            },
                            {
                                "type": "object",
                                "required": [
                                    "kind"
                                ],
                                "properties": {
                                    "kind": {
                                        "type": "string",
                                        "enum": [
                                            "string"
                                        ]
                                    }
                                }
                            }
                        ]
                    },
                    {
                        "allOf": [
                            {
                                "$ref": "#/components/schemas/SizeSpec"
                            },
                            {
                                "type": "object",
                                "required": [
                                    "kind"
                                ],
                                "properties": {
                                    "kind": {
                                        "type": "string",
                                        "enum": [
                                            "size"
                                        ]
                                    }
                                }
                            }
                        ]
                    },
                    {
                        "allOf": [
                            {
                                "$ref": "#/components/schemas/ParamSpecAspectRatio"
                            },
                            {
                                "type": "object",
                                "required": [
                                    "kind"
                                ],
                                "properties": {
                                    "kind": {
                                        "type": "string",
                                        "enum": [
                                            "aspect_ratio"
                                        ]
                                    }
                                }
                            }
                        ]
                    },
                    {
                        "allOf": [
                            {
                                "$ref": "#/components/schemas/ParamSpecSeed"
                            },
                            {
                                "type": "object",
                                "required": [
                                    "kind"
                                ],
                                "properties": {
                                    "kind": {
                                        "type": "string",
                                        "enum": [
                                            "seed"
                                        ]
                                    }
                                }
                            }
                        ]
                    }
                ]
            },
            "ParamSpecAspectRatio": {
                "type": "object",
                "required": [
                    "allowed"
                ],
                "properties": {
                    "allowed": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        }
                    },
                    "default": {
                        "type": [
                            "string",
                            "null"
                        ]
                    }
                }
            },
            "ParamSpecBool": {
                "type": "object",
                "properties": {
                    "default": {
                        "type": [
                            "boolean",
                            "null"
                        ]
                    }
                }
            },
            "ParamSpecFloat": {
                "type": "object",
                "properties": {
                    "default": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "format": "double"
                    },
                    "max": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "format": "double"
                    },
                    "min": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "format": "double"
                    }
                }
            },
            "ParamSpecInt": {
                "type": "object",
                "properties": {
                    "default": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "format": "int64"
                    },
                    "max": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "format": "int64"
                    },
                    "min": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "format": "int64"
                    }
                }
            },
            "ParamSpecSeed": {
                "type": "object",
                "required": [
                    "min",
                    "max"
                ],
                "properties": {
                    "max": {
                        "type": "integer",
                        "format": "int64"
                    },
                    "min": {
                        "type": "integer",
                        "format": "int64"
                    }
                }
            },
            "ParamSpecString": {
                "type": "object",
                "properties": {
                    "default": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "enum_values": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        }
                    },
                    "max_length": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "minimum": 0
                    },
                    "pattern": {
                        "type": [
                            "string",
                            "null"
                        ]
                    }
                }
            },
            "PasswordReset": {
                "type": "object",
                "required": [
                    "token",
                    "user_id",
                    "expires_at",
                    "created_at"
                ],
                "properties": {
                    "created_at": {
                        "type": "string",
                        "format": "date-time"
                    },
                    "expires_at": {
                        "type": "string",
                        "format": "date-time"
                    },
                    "token": {
                        "type": "string"
                    },
                    "used_at": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "user_id": {
                        "type": "string"
                    }
                }
            },
            "PasswordResetConfirmBody": {
                "type": "object",
                "required": [
                    "token",
                    "new_password"
                ],
                "properties": {
                    "new_password": {
                        "type": "string"
                    },
                    "token": {
                        "type": "string"
                    }
                }
            },
            "PasswordResetRequestBody": {
                "type": "object",
                "required": [
                    "email"
                ],
                "properties": {
                    "email": {
                        "type": "string"
                    }
                }
            },
            "PatchAccountRequest": {
                "type": "object",
                "properties": {
                    "current_password": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "new_password": {
                        "type": [
                            "string",
                            "null"
                        ]
                    }
                }
            },
            "PatchUserRequest": {
                "type": "object",
                "properties": {
                    "is_active": {
                        "type": [
                            "boolean",
                            "null"
                        ]
                    },
                    "role": {
                        "oneOf": [
                            {
                                "type": "null"
                            },
                            {
                                "$ref": "#/components/schemas/Role"
                            }
                        ]
                    }
                }
            },
            "PromptSpec": {
                "type": "object",
                "properties": {
                    "max_length": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "minimum": 0
                    },
                    "min_length": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "minimum": 0
                    },
                    "required": {
                        "type": "boolean"
                    }
                }
            },
            "ProviderConfig": {
                "type": "object",
                "description": "Configuration for a provider deployment.",
                "required": [
                    "provider",
                    "api_keys"
                ],
                "properties": {
                    "api_base": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "Base URL override."
                    },
                    "api_keys": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/ApiKeyEntry"
                        },
                        "description": "API key(s) with optional weights."
                    },
                    "enabled": {
                        "type": "boolean",
                        "description": "Whether this provider config is enabled."
                    },
                    "extra_headers": {
                        "type": "object",
                        "description": "Extra headers.",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "propertyNames": {
                            "type": "string"
                        }
                    },
                    "model_mapping": {
                        "type": "object",
                        "description": "Model ID mapping: internal ID \u2192 provider's model ID.",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "propertyNames": {
                            "type": "string"
                        }
                    },
                    "options": {
                        "description": "Provider-specific options."
                    },
                    "provider": {
                        "type": "string",
                        "description": "Provider name (e.g. \"openai\", \"stability\", \"replicate\")."
                    }
                }
            },
            "ProviderCredentialInfo": {
                "type": "object",
                "description": "Public view of a stored BYO provider credential \u2014 NEVER the plaintext secret.",
                "required": [
                    "provider",
                    "created_at"
                ],
                "properties": {
                    "created_at": {
                        "type": "string",
                        "format": "date-time"
                    },
                    "display_hint": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "provider": {
                        "type": "string"
                    }
                }
            },
            "ProviderHealth": {
                "type": "object",
                "required": [
                    "provider",
                    "healthy"
                ],
                "properties": {
                    "healthy": {
                        "type": "boolean"
                    },
                    "last_checked": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "latency_ms": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "format": "int64",
                        "minimum": 0
                    },
                    "message": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "provider": {
                        "type": "string"
                    }
                }
            },
            "ProviderUsageStat": {
                "type": "object",
                "required": [
                    "provider",
                    "requests",
                    "failures",
                    "cost_usd",
                    "avg_latency_ms"
                ],
                "properties": {
                    "avg_latency_ms": {
                        "type": "number",
                        "format": "double"
                    },
                    "cost_usd": {
                        "type": "number",
                        "format": "double"
                    },
                    "failures": {
                        "type": "integer",
                        "format": "int64",
                        "minimum": 0
                    },
                    "provider": {
                        "type": "string"
                    },
                    "requests": {
                        "type": "integer",
                        "format": "int64",
                        "minimum": 0
                    }
                }
            },
            "ProxyStats": {
                "type": "object",
                "description": "Aggregate stats for the dashboard.",
                "required": [
                    "total_requests",
                    "successful_requests",
                    "failed_requests",
                    "total_cost_usd",
                    "avg_latency_ms",
                    "requests_per_minute",
                    "models_used",
                    "providers_used",
                    "latency_percentiles"
                ],
                "properties": {
                    "avg_latency_ms": {
                        "type": "number",
                        "format": "double"
                    },
                    "failed_requests": {
                        "type": "integer",
                        "format": "int64",
                        "minimum": 0
                    },
                    "latency_percentiles": {
                        "$ref": "#/components/schemas/LatencyPercentiles"
                    },
                    "models_used": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/ModelUsageStat"
                        }
                    },
                    "providers_used": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/ProviderUsageStat"
                        }
                    },
                    "requests_per_minute": {
                        "type": "number",
                        "format": "double"
                    },
                    "successful_requests": {
                        "type": "integer",
                        "format": "int64",
                        "minimum": 0
                    },
                    "total_cost_usd": {
                        "type": "number",
                        "format": "double"
                    },
                    "total_requests": {
                        "type": "integer",
                        "format": "int64",
                        "minimum": 0
                    }
                }
            },
            "PublicUser": {
                "type": "object",
                "description": "Public user view returned from user management endpoints.",
                "required": [
                    "id",
                    "email",
                    "role",
                    "is_active",
                    "created_at"
                ],
                "properties": {
                    "created_at": {
                        "type": "string"
                    },
                    "email": {
                        "type": "string"
                    },
                    "id": {
                        "type": "string"
                    },
                    "is_active": {
                        "type": "boolean"
                    },
                    "last_login_at": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "role": {
                        "type": "string"
                    }
                }
            },
            "RefImageKind": {
                "type": "string",
                "enum": [
                    "base64",
                    "url",
                    "blob"
                ]
            },
            "RefInputSpec": {
                "type": "object",
                "required": [
                    "max_total",
                    "provider_format",
                    "roles"
                ],
                "properties": {
                    "default_role": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "max_total": {
                        "type": "integer",
                        "format": "int32",
                        "minimum": 0
                    },
                    "provider_format": {},
                    "roles": {
                        "type": "object",
                        "additionalProperties": {
                            "$ref": "#/components/schemas/RefRoleSpec"
                        },
                        "propertyNames": {
                            "type": "string"
                        }
                    }
                }
            },
            "RefProviderFormat": {
                "oneOf": [
                    {
                        "type": "object",
                        "required": [
                            "form"
                        ],
                        "properties": {
                            "form": {
                                "type": "string",
                                "enum": [
                                    "url"
                                ]
                            }
                        }
                    },
                    {
                        "type": "object",
                        "required": [
                            "form"
                        ],
                        "properties": {
                            "form": {
                                "type": "string",
                                "enum": [
                                    "base64"
                                ]
                            }
                        }
                    },
                    {
                        "allOf": [
                            {
                                "$ref": "#/components/schemas/RefProviderFormatMultipart"
                            },
                            {
                                "type": "object",
                                "required": [
                                    "form"
                                ],
                                "properties": {
                                    "form": {
                                        "type": "string",
                                        "enum": [
                                            "multipart"
                                        ]
                                    }
                                }
                            }
                        ]
                    }
                ]
            },
            "RefProviderFormatMultipart": {
                "type": "object",
                "required": [
                    "field_map"
                ],
                "properties": {
                    "field_map": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "propertyNames": {
                            "type": "string"
                        }
                    }
                }
            },
            "RefRoleSpec": {
                "type": "object",
                "required": [
                    "min_count",
                    "max_count"
                ],
                "properties": {
                    "max_count": {
                        "type": "integer",
                        "format": "int32",
                        "minimum": 0
                    },
                    "min_count": {
                        "type": "integer",
                        "format": "int32",
                        "minimum": 0
                    },
                    "required": {
                        "type": "boolean"
                    }
                }
            },
            "ReferenceImage": {
                "type": "object",
                "required": [
                    "type",
                    "value"
                ],
                "properties": {
                    "role": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "type": {
                        "$ref": "#/components/schemas/RefImageKind"
                    },
                    "value": {
                        "type": "string"
                    }
                }
            },
            "RequestLog": {
                "type": "object",
                "required": [
                    "id",
                    "model",
                    "provider",
                    "status",
                    "media_type",
                    "cost_usd",
                    "latency_ms",
                    "created_at"
                ],
                "properties": {
                    "cost_usd": {
                        "type": "number",
                        "format": "double"
                    },
                    "created_at": {
                        "type": "string",
                        "format": "date-time"
                    },
                    "error": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "id": {
                        "type": "string"
                    },
                    "latency_ms": {
                        "type": "integer",
                        "format": "int64",
                        "minimum": 0
                    },
                    "media_type": {
                        "$ref": "#/components/schemas/MediaType"
                    },
                    "metadata": {},
                    "model": {
                        "type": "string"
                    },
                    "provider": {
                        "type": "string"
                    },
                    "status": {
                        "$ref": "#/components/schemas/GenerationStatus"
                    }
                }
            },
            "RevokeKeyResponse": {
                "type": "object",
                "description": "Response for `DELETE /v1/keys/{id}` and similar revocation endpoints.",
                "required": [
                    "revoked"
                ],
                "properties": {
                    "revoked": {
                        "type": "boolean"
                    }
                }
            },
            "Role": {
                "type": "string",
                "enum": [
                    "owner",
                    "admin",
                    "member",
                    "viewer"
                ]
            },
            "RoutingStrategy": {
                "type": "string",
                "enum": [
                    "fallback",
                    "weighted_round_robin",
                    "lowest_cost",
                    "lowest_latency"
                ]
            },
            "Session": {
                "type": "object",
                "required": [
                    "id",
                    "user_id",
                    "created_at",
                    "expires_at",
                    "csrf_token"
                ],
                "properties": {
                    "created_at": {
                        "type": "string",
                        "format": "date-time"
                    },
                    "csrf_token": {
                        "type": "string"
                    },
                    "expires_at": {
                        "type": "string",
                        "format": "date-time"
                    },
                    "id": {
                        "type": "string"
                    },
                    "ip": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "user_agent": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "user_id": {
                        "type": "string"
                    }
                }
            },
            "SessionInfo": {
                "type": "object",
                "description": "Public session info (no csrf_token exposed).",
                "required": [
                    "id",
                    "created_at",
                    "expires_at"
                ],
                "properties": {
                    "created_at": {
                        "type": "string"
                    },
                    "expires_at": {
                        "type": "string"
                    },
                    "id": {
                        "type": "string"
                    },
                    "ip": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "user_agent": {
                        "type": [
                            "string",
                            "null"
                        ]
                    }
                }
            },
            "SignupRequest": {
                "type": "object",
                "required": [
                    "email",
                    "password"
                ],
                "properties": {
                    "email": {
                        "type": "string"
                    },
                    "org_name": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "Optional organization name (hosted mode). Defaults to the email local-part."
                    },
                    "password": {
                        "type": "string"
                    }
                }
            },
            "SizeSpec": {
                "oneOf": [
                    {
                        "allOf": [
                            {
                                "$ref": "#/components/schemas/SizeSpecFreeform"
                            },
                            {
                                "type": "object",
                                "required": [
                                    "mode"
                                ],
                                "properties": {
                                    "mode": {
                                        "type": "string",
                                        "enum": [
                                            "freeform"
                                        ]
                                    }
                                }
                            }
                        ]
                    },
                    {
                        "allOf": [
                            {
                                "$ref": "#/components/schemas/SizeSpecEnum"
                            },
                            {
                                "type": "object",
                                "required": [
                                    "mode"
                                ],
                                "properties": {
                                    "mode": {
                                        "type": "string",
                                        "enum": [
                                            "enum"
                                        ]
                                    }
                                }
                            }
                        ]
                    }
                ]
            },
            "SizeSpecEnum": {
                "type": "object",
                "required": [
                    "values"
                ],
                "properties": {
                    "values": {
                        "type": "array",
                        "items": {
                            "type": "array",
                            "items": {
                                "type": "integer",
                                "format": "int32",
                                "minimum": 0
                            }
                        }
                    }
                }
            },
            "SizeSpecFreeform": {
                "type": "object",
                "required": [
                    "min_width",
                    "max_width",
                    "min_height",
                    "max_height"
                ],
                "properties": {
                    "max_height": {
                        "type": "integer",
                        "format": "int32",
                        "minimum": 0
                    },
                    "max_width": {
                        "type": "integer",
                        "format": "int32",
                        "minimum": 0
                    },
                    "min_height": {
                        "type": "integer",
                        "format": "int32",
                        "minimum": 0
                    },
                    "min_width": {
                        "type": "integer",
                        "format": "int32",
                        "minimum": 0
                    },
                    "multiple_of": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "format": "int32",
                        "minimum": 0
                    }
                }
            },
            "TransferOwnerRequest": {
                "type": "object",
                "required": [
                    "new_owner_id"
                ],
                "properties": {
                    "new_owner_id": {
                        "type": "string"
                    }
                }
            },
            "UpdateAppRequest": {
                "type": "object",
                "required": [
                    "name"
                ],
                "properties": {
                    "name": {
                        "type": "string"
                    }
                }
            },
            "UpdateMemberRequest": {
                "type": "object",
                "required": [
                    "role"
                ],
                "properties": {
                    "role": {
                        "$ref": "#/components/schemas/Role"
                    }
                }
            },
            "UpdateOrgRequest": {
                "type": "object",
                "required": [
                    "name"
                ],
                "properties": {
                    "name": {
                        "type": "string"
                    }
                }
            },
            "UsageInfo": {
                "type": "object",
                "description": "Cost / usage information for a generation.",
                "required": [
                    "cost_usd",
                    "tokens",
                    "cost_source"
                ],
                "properties": {
                    "cost_source": {
                        "$ref": "#/components/schemas/CostSource",
                        "description": "Cost source: \"dynamic\" (from API) or \"estimated\" (from pricing table)."
                    },
                    "cost_usd": {
                        "type": "number",
                        "format": "double",
                        "description": "Provider cost in USD."
                    },
                    "tokens": {
                        "type": "integer",
                        "format": "int64",
                        "description": "Internal token cost.",
                        "minimum": 0
                    }
                }
            },
            "User": {
                "type": "object",
                "required": [
                    "id",
                    "email",
                    "role",
                    "created_at",
                    "updated_at",
                    "is_active"
                ],
                "properties": {
                    "created_at": {
                        "type": "string",
                        "format": "date-time"
                    },
                    "email": {
                        "type": "string"
                    },
                    "id": {
                        "type": "string"
                    },
                    "is_active": {
                        "type": "boolean"
                    },
                    "last_login_at": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "oauth_github_id": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "oauth_google_id": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "role": {
                        "$ref": "#/components/schemas/Role"
                    },
                    "updated_at": {
                        "type": "string",
                        "format": "date-time"
                    }
                }
            },
            "VideoGenerationRequest": {
                "allOf": [
                    {
                        "$ref": "#/components/schemas/BaseGenerationRequest"
                    },
                    {
                        "type": "object",
                        "properties": {
                            "aspect_ratio": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            },
                            "duration_seconds": {
                                "type": "number",
                                "format": "double"
                            },
                            "fps": {
                                "type": [
                                    "integer",
                                    "null"
                                ],
                                "format": "int32",
                                "minimum": 0
                            },
                            "resolution": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            }
                        }
                    }
                ]
            },
            "VideoGenerationResponse": {
                "type": "object",
                "description": "Video generation can be async \u2014 this is the initial response.",
                "required": [
                    "id",
                    "status",
                    "model",
                    "provider",
                    "progress",
                    "created"
                ],
                "properties": {
                    "created": {
                        "type": "integer",
                        "format": "int64",
                        "description": "Unix timestamp."
                    },
                    "error": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "Error message if failed."
                    },
                    "id": {
                        "type": "string",
                        "description": "Unique generation ID for polling."
                    },
                    "model": {
                        "type": "string",
                        "description": "The model used."
                    },
                    "progress": {
                        "type": "integer",
                        "format": "int32",
                        "description": "Progress percentage (0-100).",
                        "minimum": 0
                    },
                    "provider": {
                        "type": "string",
                        "description": "The provider."
                    },
                    "status": {
                        "$ref": "#/components/schemas/GenerationStatus",
                        "description": "Current status."
                    },
                    "usage": {
                        "oneOf": [
                            {
                                "type": "null"
                            },
                            {
                                "$ref": "#/components/schemas/UsageInfo",
                                "description": "Cost information."
                            }
                        ]
                    },
                    "video_url": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "Video URL when completed."
                    }
                }
            }
        }
    },
    "tags": [
        {
            "name": "Images",
            "description": "Image generation endpoints"
        },
        {
            "name": "Videos",
            "description": "Video generation endpoints"
        },
        {
            "name": "Models",
            "description": "Model discovery"
        },
        {
            "name": "System",
            "description": "Health checks"
        },
        {
            "name": "Dashboard",
            "description": "Stats and logs"
        },
        {
            "name": "Admin",
            "description": "API key management"
        },
        {
            "name": "Auth",
            "description": "Authentication (password + OAuth)"
        },
        {
            "name": "Users",
            "description": "User management and invitations"
        },
        {
            "name": "Account",
            "description": "Current user account and sessions"
        },
        {
            "name": "Organizations",
            "description": "Organization CRUD, members, and ownership"
        },
        {
            "name": "Applications",
            "description": "Applications and BYO provider credentials"
        }
    ]
}
