{
  "openapi": "3.1.0",
  "info": {
    "title": "Veo-3.1-Generate-Preview API",
    "description": "AI 모델을 사용하여 영상 생성 작업을 생성합니다",
    "license": {
      "name": "MIT"
    },
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://api.evolink.ai",
      "description": "프로덕션 환경"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "tags": [
    {
      "name": "비디오 생성",
      "description": "AI 비디오 생성 API"
    }
  ],
  "paths": {
    "/v1/videos/generations": {
      "post": {
        "summary": "Veo-3.1-Generate-Preview API",
        "description": "- Veo 3.1 Generate Preview는 텍스트-투-비디오, 첫 프레임 이미지-투-비디오 등을 지원합니다\n- 비동기 처리 모드이며, 반환된 작업 ID를 사용하여 [상태 조회](/ko/api-manual/task-management/get-task-detail)하세요\n- 생성된 영상 링크는 24시간 동안 유효합니다",
        "operationId": "createVideoGeneration",
        "tags": [
          "비디오 생성"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/VideoGenerationRequest"
              },
              "examples": {
                "text_to_video": {
                  "summary": "텍스트-투-비디오",
                  "value": {
                    "model": "veo-3.1-generate-preview",
                    "prompt": "A cat playing piano"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "작업이 성공적으로 생성되었습니다",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VideoGenerationResponse"
                }
              }
            }
          },
          "400": {
            "description": "요청 매개변수가 잘못되었습니다",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "error": {
                    "code": "invalid_request",
                    "message": "Invalid request parameters",
                    "type": "invalid_request_error"
                  }
                }
              }
            }
          },
          "401": {
            "description": "인증되지 않았거나 토큰이 유효하지 않거나 만료되었습니다",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "error": {
                    "code": "unauthorized",
                    "message": "Invalid or expired token",
                    "type": "authentication_error"
                  }
                }
              }
            }
          },
          "402": {
            "description": "할당량이 부족합니다. 충전이 필요합니다",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "error": {
                    "code": "insufficient_quota",
                    "message": "Insufficient quota. Please top up your account.",
                    "type": "insufficient_quota"
                  }
                }
              }
            }
          },
          "403": {
            "description": "접근이 거부되었습니다",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "error": {
                    "code": "model_access_denied",
                    "message": "Token does not have access to model: veo-3.1-generate-preview",
                    "type": "invalid_request_error"
                  }
                }
              }
            }
          },
          "429": {
            "description": "요청 한도를 초과했습니다",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "error": {
                    "code": "rate_limit_exceeded",
                    "message": "Too many requests, please try again later",
                    "type": "rate_limit_error"
                  }
                }
              }
            }
          },
          "500": {
            "description": "서버 내부 오류",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "error": {
                    "code": "internal_error",
                    "message": "Internal server error",
                    "type": "api_error"
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "VideoGenerationRequest": {
        "type": "object",
        "required": [
          "model",
          "prompt"
        ],
        "properties": {
          "model": {
            "type": "string",
            "default": "veo-3.1-generate-preview"
          },
          "prompt": {
            "type": "string",
            "description": "프롬프트, 최대 2000 토큰",
            "maxLength": 2000
          },
          "image_urls": {
            "type": "array",
            "description": "참조 이미지, 최대 3장, 각 최대 10MB",
            "items": {
              "type": "string",
              "format": "uri"
            },
            "maxItems": 3
          },
          "generation_type": {
            "type": "string",
            "description": "모드:\n- `TEXT`: 텍스트-투-비디오\n- `FIRST&LAST`: 첫-마지막 프레임, 1-2장 이미지\n- `REFERENCE`: 참조 이미지, 최대 3장, 길이 8초 고정, 화면 비율 16:9 고정, `generate_audio` 외 다른 고급 매개변수 미지원",
            "enum": [
              "TEXT",
              "FIRST&LAST",
              "REFERENCE"
            ]
          },
          "aspect_ratio": {
            "type": "string",
            "description": "동영상 화면 비율. `auto`로 설정 시: 이미지-투-비디오는 입력 이미지 비율에 따라 자동 선택, 텍스트-투-비디오는 프롬프트 내용에 따라 자동 선택",
            "enum": [
              "auto",
              "16:9",
              "9:16"
            ]
          },
          "generate_audio": {
            "type": "boolean",
            "description": "오디오 생성 (추가 비용), 기본값 `true`"
          },
          "duration": {
            "type": "integer",
            "description": "길이 (초), 기본값 `4`",
            "enum": [
              4,
              6,
              8
            ]
          },
          "n": {
            "type": "integer",
            "description": "영상 수, 기본값 `1`",
            "minimum": 1,
            "maximum": 4
          },
          "quality": {
            "type": "string",
            "description": "해상도, 기본값 `720p`",
            "enum": [
              "720p",
              "1080p",
              "4k"
            ]
          },
          "seed": {
            "type": "integer",
            "minimum": 1,
            "maximum": 4294967295
          },
          "negative_prompt": {
            "type": "string"
          },
          "person_generation": {
            "type": "string",
            "description": "인물 생성 제어, 기본값 `allow_adult`. `allow_adult`: 성인만 허용; `dont_allow`: 인물/얼굴 불허",
            "enum": [
              "allow_adult",
              "dont_allow"
            ]
          },
          "resize_mode": {
            "type": "string",
            "description": "크기 조정 모드 (I2V 전용), 기본값 `pad`",
            "enum": [
              "pad",
              "crop"
            ]
          },
          "callback_url": {
            "type": "string",
            "format": "uri"
          }
        }
      },
      "VideoGenerationResponse": {
        "type": "object",
        "properties": {
          "created": {
            "type": "integer",
            "example": 1757169743
          },
          "id": {
            "type": "string",
            "example": "task-unified-1757169743-7cvnl5zw"
          },
          "model": {
            "type": "string",
            "example": "veo-3.1-generate-preview"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "processing",
              "completed",
              "failed"
            ]
          }
        }
      },
      "ErrorResponse": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string",
                "description": "오류 코드 식별자"
              },
              "message": {
                "type": "string",
                "description": "오류 설명"
              },
              "type": {
                "type": "string",
                "description": "오류 유형"
              }
            }
          }
        }
      }
    },
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "##모든 API는 Bearer Token 인증이 필요합니다##\n\n**API Key 받기:**\n\n[API Key 관리 페이지](https://evolink.ai/dashboard/keys)를 방문하여 API Key를 받으세요\n\n**요청 헤더에 추가:**\n```\nAuthorization: Bearer YOUR_API_KEY\n```"
      }
    }
  }
}
