{
  "openapi": "3.1.0",
  "info": {
    "title": "OneOver Business API",
    "version": "1.2.0",
    "description": "REST API for chat, images, video, audio, files, apps, assets, jobs, webhooks, billing, and usage. Authenticate with Bearer oo_live_* keys. POST requests accept an Idempotency-Key header. Responses include X-RateLimit-Limit, X-RateLimit-Remaining, and X-RateLimit-Reset. OpenAI-compatible aliases live under /openai-v1. The remote MCP server is POST /mcp.",
    "contact": {
      "name": "OneOver",
      "url": "https://oneover.com/contact"
    },
    "license": {
      "name": "Proprietary",
      "url": "https://oneover.com/terms"
    }
  },
  "servers": [
    {
      "url": "https://api.oneover.com/functions/v1",
      "description": "Production"
    }
  ],
  "security": [
    {
      "BearerApiKey": []
    }
  ],
  "tags": [
    {
      "name": "chat",
      "description": "Stateless chat completions"
    },
    {
      "name": "images",
      "description": "Image generation"
    },
    {
      "name": "video",
      "description": "Async video generation"
    },
    {
      "name": "audio",
      "description": "Speech and music generation"
    },
    {
      "name": "models",
      "description": "Model catalog"
    },
    {
      "name": "usage",
      "description": "Balance and usage reporting"
    },
    {
      "name": "files",
      "description": "Presigned uploads"
    },
    {
      "name": "apps",
      "description": "Play apps"
    },
    {
      "name": "assets",
      "description": "Library assets created by the API"
    },
    {
      "name": "jobs",
      "description": "Unified job poll"
    },
    {
      "name": "webhooks",
      "description": "HMAC outbound events"
    },
    {
      "name": "billing",
      "description": "Credit packs and Checkout"
    },
    {
      "name": "openai",
      "description": "OpenAI-compatible aliases"
    },
    {
      "name": "mcp",
      "description": "Remote Model Context Protocol"
    }
  ],
  "paths": {
    "/api-v1-chat": {
      "post": {
        "operationId": "chatCompletion",
        "tags": [
          "chat"
        ],
        "summary": "Stateless chat completion",
        "description": "Send messages to any text model. Set stream=true for Server-Sent Events.",
        "security": [
          {
            "BearerApiKey": [
              "chat"
            ]
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/MemberUserId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ChatRequest"
              },
              "example": {
                "model": "gpt-5.6-sol",
                "messages": [
                  {
                    "role": "user",
                    "content": "Hello"
                  }
                ],
                "stream": false,
                "max_tokens": 1024
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Chat completion (JSON or text/event-stream when stream=true)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ChatResponse"
                }
              },
              "text/event-stream": {
                "schema": {
                  "type": "string",
                  "description": "SSE events: connection_established, content, done, error"
                }
              }
            },
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/ApiError"
          }
        }
      }
    },
    "/api-v1-images": {
      "post": {
        "operationId": "generateImage",
        "tags": [
          "images"
        ],
        "summary": "Generate an image",
        "security": [
          {
            "BearerApiKey": [
              "images"
            ]
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/MemberUserId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ImageRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Generated image URL",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ImageResponse"
                }
              }
            },
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/ApiError"
          }
        }
      }
    },
    "/api-v1-video": {
      "post": {
        "operationId": "submitVideo",
        "tags": [
          "video"
        ],
        "summary": "Submit async video generation job",
        "security": [
          {
            "BearerApiKey": [
              "video"
            ]
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/MemberUserId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/VideoSubmitRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Job accepted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VideoSubmitResponse"
                }
              }
            },
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/ApiError"
          }
        }
      },
      "get": {
        "operationId": "pollVideo",
        "tags": [
          "video"
        ],
        "summary": "Poll video job status",
        "security": [
          {
            "BearerApiKey": [
              "video"
            ]
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/MemberUserId"
          },
          {
            "name": "request_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "request_id from submit response"
          }
        ],
        "responses": {
          "200": {
            "description": "Job status",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VideoPollResponse"
                }
              }
            },
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/ApiError"
          }
        }
      }
    },
    "/api-v1-audio": {
      "post": {
        "operationId": "generateAudio",
        "tags": [
          "audio"
        ],
        "summary": "Generate speech or music",
        "security": [
          {
            "BearerApiKey": [
              "audio"
            ]
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/MemberUserId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AudioRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Generated audio URL",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AudioResponse"
                }
              }
            },
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/ApiError"
          }
        }
      }
    },
    "/api-v1-models": {
      "get": {
        "operationId": "listModels",
        "tags": [
          "models"
        ],
        "summary": "List org-visible models",
        "security": [
          {
            "BearerApiKey": [
              "usage"
            ]
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/MemberUserId"
          },
          {
            "name": "type",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "text",
                "image",
                "video"
              ]
            },
            "description": "Filter by model type"
          }
        ],
        "responses": {
          "200": {
            "description": "Model catalog",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ModelsResponse"
                }
              }
            },
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/ApiError"
          }
        }
      }
    },
    "/api-v1-usage": {
      "get": {
        "operationId": "getUsage",
        "tags": [
          "usage"
        ],
        "summary": "Balance or usage reporting",
        "security": [
          {
            "BearerApiKey": [
              "usage"
            ]
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/MemberUserId"
          },
          {
            "name": "view",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "balance",
                "usage"
              ],
              "default": "usage"
            }
          },
          {
            "name": "days",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 90,
              "default": 30
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 50
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Balance or usage data",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/BalanceResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UsageResponse"
                    }
                  ]
                }
              }
            },
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/ApiError"
          }
        }
      }
    },
    "/api-v1-files": {
      "get": {
        "tags": [
          "files"
        ],
        "summary": "Fetch a file record",
        "operationId": "getFile",
        "security": [
          {
            "BearerApiKey": [
              "files"
            ]
          }
        ],
        "parameters": [
          {
            "name": "file_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "File record",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "request_id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "file": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            },
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/ApiError"
          }
        }
      },
      "post": {
        "tags": [
          "files"
        ],
        "summary": "Presign a file upload, or confirm an existing file_id",
        "operationId": "createFile",
        "security": [
          {
            "BearerApiKey": [
              "files"
            ]
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "filename": {
                    "type": "string"
                  },
                  "mime_type": {
                    "type": "string"
                  },
                  "confirm": {
                    "type": "boolean",
                    "description": "When true with file_id, return the stored URL"
                  },
                  "file_id": {
                    "type": "string",
                    "format": "uuid"
                  }
                }
              },
              "example": {
                "filename": "ref.png",
                "mime_type": "image/png"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "file_id, upload_url, and public url",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "request_id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "file_id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "upload_url": {
                      "type": "string",
                      "format": "uri"
                    },
                    "url": {
                      "type": "string",
                      "format": "uri"
                    },
                    "headers": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            },
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/ApiError"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api-v1-apps": {
      "get": {
        "tags": [
          "apps"
        ],
        "summary": "List live Play apps",
        "operationId": "listApps",
        "security": [
          {
            "BearerApiKey": [
              "apps"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "App registry",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "request_id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "apps": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    }
                  }
                }
              }
            },
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/ApiError"
          }
        },
        "parameters": []
      },
      "post": {
        "tags": [
          "apps"
        ],
        "summary": "Run a Play app",
        "operationId": "runApp",
        "security": [
          {
            "BearerApiKey": [
              "apps"
            ]
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "app_id",
                  "prompt"
                ],
                "properties": {
                  "app_id": {
                    "type": "string"
                  },
                  "prompt": {
                    "type": "string"
                  },
                  "model": {
                    "type": "string",
                    "description": "Defaults to flux-2-pro"
                  },
                  "reference_image": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Generated image for the app",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "request_id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "app_id": {
                      "type": "string"
                    },
                    "image_url": {
                      "type": "string",
                      "format": "uri"
                    },
                    "asset_id": {
                      "type": "string",
                      "format": "uuid",
                      "nullable": true
                    },
                    "credits_charged": {
                      "type": "integer"
                    },
                    "balance": {
                      "$ref": "#/components/schemas/Balance"
                    }
                  }
                }
              }
            },
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/ApiError"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api-v1-assets": {
      "get": {
        "tags": [
          "assets"
        ],
        "summary": "List library assets, or fetch one by asset_id",
        "operationId": "listAssets",
        "security": [
          {
            "BearerApiKey": [
              "assets"
            ]
          }
        ],
        "parameters": [
          {
            "name": "asset_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            },
            "description": "Page size"
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Opaque cursor from the previous page next_cursor"
          }
        ],
        "responses": {
          "200": {
            "description": "One asset, or a page of assets with next_cursor",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "request_id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "asset": {
                      "type": "object",
                      "additionalProperties": true
                    },
                    "assets": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    },
                    "count": {
                      "type": "integer"
                    },
                    "next_cursor": {
                      "type": "string",
                      "nullable": true
                    }
                  }
                }
              }
            },
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/ApiError"
          }
        }
      },
      "delete": {
        "tags": [
          "assets"
        ],
        "summary": "Delete one library asset",
        "operationId": "deleteAsset",
        "security": [
          {
            "BearerApiKey": [
              "assets"
            ]
          }
        ],
        "parameters": [
          {
            "name": "asset_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "request_id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "deleted": {
                      "type": "boolean"
                    }
                  }
                }
              }
            },
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/ApiError"
          }
        }
      }
    },
    "/api-v1-jobs": {
      "get": {
        "tags": [
          "jobs"
        ],
        "summary": "Poll one job, or list recent jobs",
        "operationId": "getJob",
        "description": "Pass request_id to poll one video or recorded job. Omit it to page recent api_jobs. A video-scoped key is also accepted.",
        "security": [
          {
            "BearerApiKey": [
              "jobs"
            ]
          }
        ],
        "parameters": [
          {
            "name": "request_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            },
            "description": "Page size"
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Opaque cursor from the previous page next_cursor"
          }
        ],
        "responses": {
          "200": {
            "description": "Job or page",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "request_id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "job": {
                      "type": "object",
                      "additionalProperties": true
                    },
                    "jobs": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    },
                    "next_cursor": {
                      "type": "string",
                      "nullable": true
                    }
                  }
                }
              }
            },
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/ApiError"
          }
        }
      }
    },
    "/api-v1-webhooks": {
      "get": {
        "tags": [
          "webhooks"
        ],
        "summary": "List webhook endpoints",
        "operationId": "listWebhooks",
        "security": [
          {
            "BearerApiKey": [
              "webhooks"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "Endpoints",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "request_id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "endpoints": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    }
                  }
                }
              }
            },
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/ApiError"
          }
        },
        "parameters": []
      },
      "post": {
        "tags": [
          "webhooks"
        ],
        "summary": "Register or disable a webhook",
        "operationId": "createWebhook",
        "description": "job.completed and job.failed are emitted for video jobs. credits.low is emitted when a charge drops the org balance under 100 credits. Images and audio do not emit job events. The signing secret is returned once.",
        "security": [
          {
            "BearerApiKey": [
              "webhooks"
            ]
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "action": {
                    "type": "string",
                    "enum": [
                      "create",
                      "disable"
                    ],
                    "default": "create"
                  },
                  "url": {
                    "type": "string",
                    "format": "uri",
                    "description": "Required for create. Must be https"
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "job.completed",
                        "job.failed",
                        "credits.low"
                      ]
                    }
                  },
                  "endpoint_id": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Required when action is disable"
                  }
                }
              },
              "example": {
                "url": "https://example.com/hooks/oneover",
                "events": [
                  "job.completed",
                  "job.failed"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Endpoint, and secret on create",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "request_id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "endpoint": {
                      "type": "object",
                      "additionalProperties": true
                    },
                    "secret": {
                      "type": "string"
                    },
                    "warning": {
                      "type": "string"
                    },
                    "disabled": {
                      "type": "boolean"
                    }
                  }
                }
              }
            },
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/ApiError"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api-v1-billing": {
      "get": {
        "tags": [
          "billing"
        ],
        "summary": "Billing mode, packs, auto top-up settings, and balance",
        "operationId": "getBilling",
        "description": "Accepts the billing scope, or usage.",
        "security": [
          {
            "BearerApiKey": [
              "billing"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "Billing snapshot",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "request_id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "billing_mode": {
                      "type": "string",
                      "enum": [
                        "personal",
                        "organization"
                      ]
                    },
                    "packs": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    },
                    "default_package_id": {
                      "type": "string"
                    },
                    "settings": {
                      "type": "object",
                      "additionalProperties": true
                    },
                    "balance": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            },
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/ApiError"
          }
        },
        "parameters": []
      },
      "post": {
        "tags": [
          "billing"
        ],
        "summary": "Create a Stripe Checkout top-up URL, or update team auto top-up",
        "operationId": "createBillingSession",
        "security": [
          {
            "BearerApiKey": [
              "billing"
            ]
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "action": {
                    "type": "string",
                    "enum": [
                      "create_topup_session",
                      "update_auto_topup"
                    ],
                    "default": "create_topup_session"
                  },
                  "package_id": {
                    "type": "string",
                    "description": "Personal: credits_5, credits_10, credits_20. Team: org_credits_100, org_credits_500, org_credits_2000"
                  },
                  "success_url": {
                    "type": "string",
                    "format": "uri"
                  },
                  "cancel_url": {
                    "type": "string",
                    "format": "uri"
                  },
                  "auto_topup_enabled": {
                    "type": "boolean"
                  },
                  "threshold_credits": {
                    "type": "integer"
                  },
                  "topup_pack_id": {
                    "type": "string"
                  },
                  "monthly_cap_cents": {
                    "type": "integer"
                  },
                  "stripe_payment_method_id": {
                    "type": "string"
                  }
                }
              },
              "example": {
                "action": "create_topup_session",
                "package_id": "credits_5"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "checkout_url or auto top-up acknowledgement",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "request_id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "billing_mode": {
                      "type": "string"
                    },
                    "checkout_url": {
                      "type": "string",
                      "format": "uri"
                    },
                    "package_id": {
                      "type": "string"
                    },
                    "ok": {
                      "type": "boolean"
                    }
                  }
                }
              }
            },
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/ApiError"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/openai-v1/chat/completions": {
      "post": {
        "tags": [
          "openai"
        ],
        "summary": "OpenAI-compatible chat completions",
        "operationId": "openaiChatCompletions",
        "description": "Forwards to api-v1-chat. stream=true returns text/event-stream.",
        "security": [
          {
            "BearerApiKey": [
              "chat"
            ]
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "model",
                  "messages"
                ],
                "properties": {
                  "model": {
                    "type": "string"
                  },
                  "messages": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  },
                  "stream": {
                    "type": "boolean",
                    "default": false
                  },
                  "max_tokens": {
                    "type": "integer"
                  },
                  "tools": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "chat.completion or an event stream",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              },
              "text/event-stream": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/ApiError"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/openai-v1/models": {
      "get": {
        "tags": [
          "openai"
        ],
        "summary": "OpenAI-compatible model list",
        "operationId": "openaiModels",
        "security": [
          {
            "BearerApiKey": [
              "usage"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "list",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string",
                      "enum": [
                        "list"
                      ]
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "object": {
                            "type": "string"
                          },
                          "owned_by": {
                            "type": "string"
                          }
                        }
                      }
                    }
                  }
                }
              }
            },
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/ApiError"
          }
        },
        "parameters": []
      }
    },
    "/openai-v1/images/generations": {
      "post": {
        "tags": [
          "openai"
        ],
        "summary": "OpenAI-compatible image generations",
        "operationId": "openaiImageGenerations",
        "security": [
          {
            "BearerApiKey": [
              "images"
            ]
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "prompt"
                ],
                "properties": {
                  "model": {
                    "type": "string",
                    "description": "Defaults to flux-2-pro"
                  },
                  "prompt": {
                    "type": "string"
                  },
                  "n": {
                    "type": "integer"
                  },
                  "image": {
                    "type": "string",
                    "description": "Reference image. Also accepted on /images/edits"
                  },
                  "mask": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "images",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            },
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/ApiError"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/openai-v1/images/edits": {
      "post": {
        "tags": [
          "openai"
        ],
        "summary": "OpenAI-compatible image edits",
        "operationId": "openaiImageEdits",
        "description": "Same handler as image generations. prompt is required. image and mask are forwarded as reference_image and mask.",
        "security": [
          {
            "BearerApiKey": [
              "images"
            ]
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "prompt"
                ],
                "properties": {
                  "model": {
                    "type": "string"
                  },
                  "prompt": {
                    "type": "string"
                  },
                  "image": {
                    "type": "string"
                  },
                  "mask": {
                    "type": "string"
                  },
                  "n": {
                    "type": "integer"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "images",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            },
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/ApiError"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/mcp": {
      "post": {
        "tags": [
          "mcp"
        ],
        "summary": "Remote MCP JSON-RPC",
        "operationId": "mcpJsonRpc",
        "description": "Streamable HTTP Model Context Protocol endpoint. Same Bearer key as the REST API. tools/list omits create_topup unless the key has the billing scope. Tools: chat, list_models, generate_image, generate_video, check_video, generate_audio, run_app, create_run, get_run, get_job, list_assets, get_usage, build_create, build_iterate, build_status, build_get_files, build_stop, build_publish, create_topup.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "jsonrpc",
                  "method"
                ],
                "properties": {
                  "jsonrpc": {
                    "type": "string",
                    "enum": [
                      "2.0"
                    ]
                  },
                  "id": {
                    "type": [
                      "string",
                      "integer",
                      "null"
                    ]
                  },
                  "method": {
                    "type": "string"
                  },
                  "params": {
                    "type": "object",
                    "additionalProperties": true
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "JSON-RPC result",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            },
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/ApiError"
          }
        },
        "parameters": []
      }
    }
  },
  "components": {
    "securitySchemes": {
      "BearerApiKey": {
        "type": "http",
        "scheme": "bearer",
        "description": "API key starting with oo_live_. Scopes: chat, images, video, audio, usage, files, apps, assets, jobs, webhooks, billing."
      }
    },
    "parameters": {
      "MemberUserId": {
        "name": "X-Member-User-Id",
        "in": "header",
        "required": false,
        "schema": {
          "type": "string",
          "format": "uuid"
        },
        "description": "Optional internal user UUID for per-member attribution"
      },
      "IdempotencyKey": {
        "name": "Idempotency-Key",
        "in": "header",
        "required": false,
        "schema": {
          "type": "string",
          "minLength": 8,
          "maxLength": 256
        },
        "description": "Caller-supplied key on POST. The same key and body replay the original response. A different body returns idempotency_conflict."
      }
    },
    "responses": {
      "ApiError": {
        "description": "API error",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorEnvelope"
            }
          }
        },
        "headers": {
          "X-RateLimit-Limit": {
            "$ref": "#/components/headers/RateLimitLimit"
          },
          "X-RateLimit-Remaining": {
            "$ref": "#/components/headers/RateLimitRemaining"
          },
          "X-RateLimit-Reset": {
            "$ref": "#/components/headers/RateLimitReset"
          },
          "Retry-After": {
            "$ref": "#/components/headers/RetryAfter"
          }
        }
      }
    },
    "schemas": {
      "ErrorEnvelope": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "object",
            "required": [
              "code",
              "message"
            ],
            "properties": {
              "code": {
                "type": "string",
                "enum": [
                  "unauthorized",
                  "invalid_key",
                  "key_not_found",
                  "org_inactive",
                  "scope_denied",
                  "model_not_allowed",
                  "insufficient_credits",
                  "rate_limit_exceeded",
                  "validation_error",
                  "internal_error",
                  "content_policy",
                  "idempotency_conflict",
                  "idempotency_in_progress"
                ]
              },
              "message": {
                "type": "string"
              },
              "request_id": {
                "type": "string",
                "format": "uuid",
                "nullable": true
              }
            }
          }
        }
      },
      "Balance": {
        "type": "object",
        "properties": {
          "subscription": {
            "type": "integer"
          },
          "anytime": {
            "type": "integer"
          }
        }
      },
      "ChatRequest": {
        "type": "object",
        "required": [
          "model",
          "messages"
        ],
        "properties": {
          "model": {
            "type": "string"
          },
          "messages": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "role",
                "content"
              ],
              "properties": {
                "role": {
                  "type": "string",
                  "enum": [
                    "system",
                    "user",
                    "assistant"
                  ]
                },
                "content": {
                  "type": "string"
                }
              }
            }
          },
          "stream": {
            "type": "boolean",
            "default": false
          },
          "max_tokens": {
            "type": "integer"
          }
        }
      },
      "ChatResponse": {
        "type": "object",
        "properties": {
          "request_id": {
            "type": "string",
            "format": "uuid"
          },
          "model": {
            "type": "string"
          },
          "message": {
            "type": "object",
            "properties": {
              "role": {
                "type": "string"
              },
              "content": {
                "type": "string"
              }
            }
          },
          "credits_charged": {
            "type": "integer"
          },
          "balance": {
            "$ref": "#/components/schemas/Balance"
          },
          "efficiency": {
            "type": "object",
            "additionalProperties": true
          }
        }
      },
      "ImageRequest": {
        "type": "object",
        "required": [
          "model",
          "prompt"
        ],
        "properties": {
          "model": {
            "type": "string"
          },
          "prompt": {
            "type": "string"
          },
          "negative_prompt": {
            "type": "string"
          },
          "aspect_ratio": {
            "type": "string"
          },
          "resolution_tier": {
            "type": "string",
            "enum": [
              "1k",
              "2k",
              "4k"
            ]
          },
          "n": {
            "type": "integer",
            "minimum": 1,
            "maximum": 4,
            "default": 1,
            "description": "Number of images. Credits are charged per image."
          },
          "store": {
            "type": "string",
            "enum": [
              "library",
              "url",
              "none"
            ],
            "description": "library persists the image on the org. url returns a URL only. none does not persist."
          },
          "mask": {
            "type": "string",
            "description": "Base64-encoded inpainting mask"
          },
          "reference_image": {
            "type": "string",
            "description": "One reference image, base64 or a fetchable URL"
          },
          "reference_images": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Additional reference images, combined with reference_image"
          }
        }
      },
      "ImageResponse": {
        "type": "object",
        "properties": {
          "request_id": {
            "type": "string",
            "format": "uuid"
          },
          "model": {
            "type": "string"
          },
          "image_url": {
            "type": "string",
            "format": "uri",
            "description": "First generated image"
          },
          "image_urls": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uri"
            }
          },
          "asset_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Library ids when store is library"
          },
          "credits_charged": {
            "type": "integer"
          },
          "balance": {
            "$ref": "#/components/schemas/Balance"
          }
        }
      },
      "VideoSubmitRequest": {
        "type": "object",
        "required": [
          "model"
        ],
        "properties": {
          "model": {
            "type": "string"
          },
          "prompt": {
            "type": "string"
          },
          "duration": {
            "type": "number"
          },
          "resolution": {
            "type": "string"
          },
          "aspect_ratio": {
            "type": "string"
          },
          "generate_audio": {
            "type": "boolean"
          },
          "video_draft": {
            "type": "boolean"
          },
          "reference_image": {
            "type": "string",
            "description": "Base64-encoded image"
          },
          "reference_video": {
            "type": "string",
            "description": "Base64-encoded video"
          },
          "reference_audio": {
            "type": "string",
            "description": "Base64-encoded audio"
          },
          "keep_audio": {
            "type": "boolean"
          },
          "omni_task": {
            "type": "string",
            "enum": [
              "text_to_video",
              "image_to_video",
              "reference_to_video",
              "edit"
            ]
          },
          "seed": {
            "type": "integer"
          }
        }
      },
      "VideoSubmitResponse": {
        "type": "object",
        "properties": {
          "request_id": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "type": "string",
            "enum": [
              "processing"
            ]
          },
          "model": {
            "type": "string"
          },
          "credits_estimate": {
            "type": "integer"
          }
        }
      },
      "VideoPollResponse": {
        "type": "object",
        "properties": {
          "request_id": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "type": "string",
            "enum": [
              "processing",
              "complete",
              "failed"
            ]
          },
          "model": {
            "type": "string"
          },
          "video_url": {
            "type": "string",
            "format": "uri"
          },
          "provider_status": {
            "type": "string"
          },
          "credits_charged": {
            "type": "integer"
          },
          "balance": {
            "$ref": "#/components/schemas/Balance"
          }
        }
      },
      "AudioRequest": {
        "type": "object",
        "required": [
          "model",
          "prompt"
        ],
        "properties": {
          "model": {
            "type": "string"
          },
          "prompt": {
            "type": "string"
          },
          "audio_kind": {
            "type": "string",
            "enum": [
              "speech",
              "music"
            ],
            "default": "speech"
          },
          "voice": {
            "type": "string"
          },
          "speakers": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "speed": {
            "type": "number"
          },
          "music_style": {
            "type": "string"
          },
          "duration_seconds": {
            "type": "number"
          },
          "reference_image_urls": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uri"
            }
          }
        }
      },
      "AudioResponse": {
        "type": "object",
        "properties": {
          "request_id": {
            "type": "string",
            "format": "uuid"
          },
          "model": {
            "type": "string"
          },
          "audio_kind": {
            "type": "string"
          },
          "audio_url": {
            "type": "string",
            "format": "uri"
          },
          "credits_charged": {
            "type": "integer"
          },
          "balance": {
            "$ref": "#/components/schemas/Balance"
          }
        }
      },
      "ModelsResponse": {
        "type": "object",
        "properties": {
          "request_id": {
            "type": "string",
            "format": "uuid"
          },
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "org_plan": {
            "type": "string"
          },
          "models": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "type": {
                  "type": "string"
                },
                "provider": {
                  "type": "string"
                },
                "credits_per_request": {
                  "type": "integer"
                }
              }
            }
          },
          "count": {
            "type": "integer"
          }
        }
      },
      "BalanceResponse": {
        "type": "object",
        "properties": {
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "plan": {
            "type": "string"
          },
          "balance": {
            "type": "object",
            "properties": {
              "subscription_credits": {
                "type": "integer"
              },
              "anytime_credits": {
                "type": "integer"
              },
              "total_credits": {
                "type": "integer"
              },
              "subscription_credits_expire_at": {
                "type": "string",
                "format": "date-time"
              }
            }
          },
          "recent_ledger": {
            "type": "array",
            "items": {
              "type": "object"
            }
          }
        }
      },
      "UsageResponse": {
        "type": "object",
        "properties": {
          "summary": {
            "type": "object"
          },
          "by_api_key": {
            "type": "array",
            "items": {
              "type": "object"
            }
          },
          "by_member": {
            "type": "array",
            "items": {
              "type": "object"
            }
          },
          "requests": {
            "type": "array",
            "items": {
              "type": "object"
            }
          }
        }
      }
    },
    "headers": {
      "RateLimitLimit": {
        "description": "Requests allowed per minute for this key (60 standard, 300 elevated)",
        "schema": {
          "type": "integer"
        }
      },
      "RateLimitRemaining": {
        "description": "Requests remaining in the current minute window",
        "schema": {
          "type": "integer"
        }
      },
      "RateLimitReset": {
        "description": "Unix timestamp when the current minute window resets",
        "schema": {
          "type": "integer"
        }
      },
      "RetryAfter": {
        "description": "Seconds to wait. Sent on 429 rate_limit_exceeded",
        "schema": {
          "type": "integer"
        }
      }
    }
  }
}
