{
  "openapi": "3.1.0",
  "info": {
    "title": "FrameGate 客户接入 API",
    "version": "1.0.0",
    "description": "仅包含客户业务 API。生成请求须携带 Idempotency-Key，模型和价格以当前 Key 的 /v1/models 为准。响应字段和示例详见 customer-api.html。"
  },
  "servers": [
    {
      "url": "https://api.myanimforge.com"
    }
  ],
  "paths": {
    "/v1/models": {
      "get": {
        "tags": [
          "Gateway"
        ],
        "summary": "Gateway Models",
        "operationId": "gateway_models_v1_models_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ]
      }
    },
    "/v1/balance": {
      "get": {
        "tags": [
          "Gateway"
        ],
        "summary": "Balance",
        "operationId": "balance_v1_balance_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ]
      }
    },
    "/v1/usage": {
      "get": {
        "tags": [
          "Gateway"
        ],
        "summary": "Gateway Usage",
        "operationId": "gateway_usage_v1_usage_get",
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "parameters": [
          {
            "name": "start",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "date-time"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Start"
            }
          },
          {
            "name": "end",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "date-time"
                },
                {
                  "type": "null"
                }
              ],
              "title": "End"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/chat/completions": {
      "post": {
        "tags": [
          "Gateway"
        ],
        "summary": "Chat",
        "operationId": "chat_v1_chat_completions_post",
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 100
            },
            "description": "必填，8–100 字符；同一业务重试必须保持此键和请求体一致。"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ChatInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/videos": {
      "post": {
        "tags": [
          "Gateway"
        ],
        "summary": "Video",
        "operationId": "video_v1_videos_post",
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 100
            },
            "description": "必填，8–100 字符；同一业务重试必须保持此键和请求体一致。"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/VideoInput"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/videos/{video_id}": {
      "get": {
        "tags": [
          "Gateway"
        ],
        "summary": "Get Video",
        "operationId": "get_video_v1_videos__video_id__get",
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "parameters": [
          {
            "name": "video_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "title": "Video Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/images/generations": {
      "post": {
        "tags": [
          "Gateway"
        ],
        "summary": "Image Generate",
        "operationId": "image_generate_v1_images_generations_post",
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 100
            },
            "description": "必填，8–100 字符；同一业务重试必须保持此键和请求体一致。"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ImageInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/images/{image_id}": {
      "get": {
        "tags": [
          "Gateway"
        ],
        "summary": "Get Image",
        "operationId": "get_image_v1_images__image_id__get",
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "parameters": [
          {
            "name": "image_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "title": "Image Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "ChatInput": {
        "properties": {
          "model": {
            "type": "string",
            "maxLength": 80,
            "title": "Model"
          },
          "messages": {
            "items": {
              "additionalProperties": true,
              "type": "object"
            },
            "type": "array",
            "maxItems": 256,
            "minItems": 1,
            "title": "Messages"
          },
          "max_tokens": {
            "type": "integer",
            "maximum": 65536.0,
            "minimum": 1.0,
            "title": "Max Tokens",
            "default": 1024
          },
          "stream": {
            "type": "boolean",
            "title": "Stream",
            "default": false
          },
          "service_tier": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "standard",
                  "priority"
                ]
              },
              {
                "type": "null"
              }
            ],
            "title": "Service Tier"
          },
          "temperature": {
            "anyOf": [
              {
                "type": "number",
                "maximum": 2.0,
                "minimum": 0.0
              },
              {
                "type": "null"
              }
            ],
            "title": "Temperature"
          },
          "top_p": {
            "anyOf": [
              {
                "type": "number",
                "maximum": 1.0,
                "minimum": 0.0
              },
              {
                "type": "null"
              }
            ],
            "title": "Top P"
          },
          "tools": {
            "anyOf": [
              {
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array",
                "maxItems": 64
              },
              {
                "type": "null"
              }
            ],
            "title": "Tools"
          },
          "tool_choice": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Tool Choice"
          },
          "response_format": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Response Format"
          },
          "stop": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Stop"
          }
        },
        "additionalProperties": false,
        "type": "object",
        "required": [
          "model",
          "messages"
        ],
        "title": "ChatInput"
      },
      "HTTPValidationError": {
        "properties": {
          "detail": {
            "items": {
              "$ref": "#/components/schemas/ValidationError"
            },
            "type": "array",
            "title": "Detail"
          }
        },
        "type": "object",
        "title": "HTTPValidationError"
      },
      "ImageInput": {
        "properties": {
          "model": {
            "type": "string",
            "maxLength": 80,
            "title": "Model"
          },
          "prompt": {
            "type": "string",
            "maxLength": 12000,
            "minLength": 1,
            "title": "Prompt"
          },
          "n": {
            "type": "integer",
            "maximum": 10.0,
            "minimum": 1.0,
            "title": "N",
            "default": 1
          },
          "media": {
            "items": {
              "$ref": "#/components/schemas/Media"
            },
            "type": "array",
            "maxItems": 10,
            "title": "Media"
          },
          "options": {
            "additionalProperties": true,
            "type": "object",
            "title": "Options"
          }
        },
        "additionalProperties": false,
        "type": "object",
        "required": [
          "model",
          "prompt"
        ],
        "title": "ImageInput"
      },
      "Media": {
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "image",
              "video",
              "audio"
            ],
            "title": "Type"
          },
          "url": {
            "type": "string",
            "maxLength": 8192,
            "pattern": "^https://[^\\s]+$",
            "title": "Url"
          },
          "role": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "first_frame",
                  "last_frame",
                  "reference_image",
                  "reference_video",
                  "reference_audio",
                  "video",
                  "driving_audio"
                ]
              },
              {
                "type": "null"
              }
            ],
            "title": "Role"
          }
        },
        "additionalProperties": false,
        "type": "object",
        "required": [
          "type",
          "url"
        ],
        "title": "Media"
      },
      "ValidationError": {
        "properties": {
          "loc": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "integer"
                }
              ]
            },
            "type": "array",
            "title": "Location"
          },
          "msg": {
            "type": "string",
            "title": "Message"
          },
          "type": {
            "type": "string",
            "title": "Error Type"
          },
          "input": {
            "title": "Input"
          },
          "ctx": {
            "type": "object",
            "title": "Context"
          }
        },
        "type": "object",
        "required": [
          "loc",
          "msg",
          "type"
        ],
        "title": "ValidationError"
      },
      "VideoInput": {
        "properties": {
          "model": {
            "type": "string",
            "maxLength": 80,
            "title": "Model"
          },
          "prompt": {
            "type": "string",
            "maxLength": 12000,
            "minLength": 1,
            "title": "Prompt"
          },
          "duration_seconds": {
            "type": "integer",
            "maximum": 3600.0,
            "minimum": 1.0,
            "title": "Duration Seconds"
          },
          "media": {
            "items": {
              "$ref": "#/components/schemas/Media"
            },
            "type": "array",
            "maxItems": 50,
            "title": "Media"
          },
          "options": {
            "additionalProperties": true,
            "type": "object",
            "title": "Options"
          }
        },
        "additionalProperties": false,
        "type": "object",
        "required": [
          "model",
          "prompt",
          "duration_seconds"
        ],
        "title": "VideoInput"
      }
    },
    "securitySchemes": {
      "HTTPBearer": {
        "type": "http",
        "scheme": "bearer"
      }
    }
  }
}