{
  "openapi": "3.1.0",
  "info": {"title": "wan2.7-image-to-video API", "description": "WAN2.7 모델로 이미지에서 동영상을 생성합니다. 시작/종료 프레임 이미지, 동영상 연속 클립, 오디오 구동 생성 지원", "license": {"name": "MIT"}, "version": "1.0.0"},
  "servers": [{"url": "https://api.evolink.ai", "description": "프로덕션 환경"}],
  "security": [{"bearerAuth": []}],
  "paths": {
    "/v1/videos/generations": {
      "post": {
        "summary": "wan2.7-image-to-video API",
        "description": "- WAN2.7 (wan2.7-image-to-video) 모델은 이미지→동영상 생성 모드를 지원하며, 멀티모달 입력(이미지 / 오디오 / 동영상)을 지원합니다\n- `generation_mode` 파라미터로 세 가지 모드 중 선택:\n  - `first_frame`: **시작 프레임→동영상** — 시작 프레임 이미지로부터 동영상 생성, 구동 오디오 선택 가능\n  - `first_last_frame`: **시작/종료 프레임→동영상** — 시작 프레임과 종료 프레임 사이를 보간하여 동영상 생성, 구동 오디오 선택 가능\n  - `video_continuation`: **동영상 연속** — 입력 동영상 클립의 후속 내용을 생성, 종료 프레임 이미지 선택 가능(구동 오디오 미지원)\n- `generation_mode`는 선택 사항(하위 호환). 미지정 시 요청 내 소재 유형에 따라 적절한 모드가 자동 선택됩니다\n- 유효한 소재 조합(다른 조합은 거부됩니다):\n  1. `image_start`(시작 프레임)\n  2. `image_start` + `audio_urls`(시작 프레임 + 구동 오디오)\n  3. `image_start` + `image_end`(시작/종료 프레임)\n  4. `image_start` + `image_end` + `audio_urls`(시작/종료 프레임 + 구동 오디오)\n  5. `video_urls`(동영상 연속)\n  6. `video_urls` + `image_end`(동영상 연속 + 종료 프레임)\n- 비동기 처리 모드, 반환된 작업 ID로 [상태 조회](/ko/api-manual/task-management/get-task-detail)\n- 생성된 동영상 링크는 24시간 유효합니다. 가능한 한 빨리 저장하세요",
        "operationId": "createWan27ImageToVideoGeneration",
        "tags": ["동영상 생성"],
        "requestBody": {"required": true, "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Wan27ImageToVideoRequest"}, "examples": {
          "first_frame": {"summary": "시작 프레임→동영상", "value": {"model": "wan2.7-image-to-video", "generation_mode": "first_frame", "prompt": "피아노를 치는 고양이", "image_start": "https://example.com/first_frame.jpg"}},
          "first_frame_with_audio": {"summary": "시작 프레임 + 구동 오디오", "value": {"model": "wan2.7-image-to-video", "generation_mode": "first_frame", "prompt": "영어 랩을 부르는 청년", "image_start": "https://example.com/first_frame.jpg", "audio_urls": ["https://example.com/rap.mp3"]}},
          "first_last_frame": {"summary": "시작/종료 프레임→동영상", "value": {"model": "wan2.7-image-to-video", "generation_mode": "first_last_frame", "prompt": "카메라가 눈높이에서 점차 위로 올라가 부감으로 전환", "image_start": "https://example.com/first_frame.png", "image_end": "https://example.com/last_frame.png"}},
          "video_continuation": {"summary": "동영상 연속", "value": {"model": "wan2.7-image-to-video", "generation_mode": "video_continuation", "prompt": "거울 앞에서 셀카를 찍은 소녀가 가방을 메고 집을 나섬", "video_urls": ["https://example.com/clip.mp4"]}}
        }}}},
        "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: wan2.7-image-to-video", "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": {
      "Wan27ImageToVideoRequest": {
        "required": ["model"],
        "type": "object",
        "properties": {
          "model": {"type": "string", "description": "모델명, `wan2.7-image-to-video` 고정", "enum": ["wan2.7-image-to-video"], "example": "wan2.7-image-to-video"},
          "generation_mode": {"type": "string", "description": "유효한 소재 조합을 결정하는 생성 모드. **명시적 지정을 권장합니다**\n\n**값:**\n- `first_frame`: 시작 프레임→동영상. 필수: `image_start`. 선택: `audio_urls`. 거부: `image_end`, `video_urls`\n- `first_last_frame`: 시작/종료 프레임→동영상. 필수: `image_start` + `image_end`. 선택: `audio_urls`. 거부: `video_urls`\n- `video_continuation`: 동영상 연속. 필수: `video_urls[0]`. 선택: `image_end`(종료 프레임으로 사용). 거부: `image_start`, `audio_urls`\n\n**하위 호환 동작:** `generation_mode`를 생략하면 요청 내 소재 유형에 따라 적절한 모드가 자동 선택됩니다. 모호함을 피하기 위해 명시적 지정을 권장합니다", "enum": ["first_frame", "first_last_frame", "video_continuation"], "example": "first_frame"},
          "prompt": {"type": "string", "description": "동영상 생성용 텍스트 프롬프트. 중국어와 영어 지원, 각 글자/문자를 1자로 카운트하며 초과분은 자동으로 잘립니다. 최대 5000자", "maxLength": 5000, "example": "피아노를 치는 고양이"},
          "negative_prompt": {"type": "string", "description": "동영상에 나타나지 않기를 원하는 내용을 기술하는 네거티브 프롬프트. 중국어와 영어 지원, 최대 500자, 초과분은 자동으로 잘립니다", "maxLength": 500, "example": "흐림, 저품질"},
          "image_start": {"type": "string", "format": "uri", "description": "시작 프레임 이미지 URL\n\n**모드 제약:**\n- `first_frame` 모드: **필수**\n- `first_last_frame` 모드: **필수**\n- `video_continuation` 모드: **전송 불가**\n\n**이미지 제한:**\n- 포맷: JPEG, JPG, PNG(투명도 미지원), BMP, WEBP\n- 해상도: 가로/세로가 `[240, 8000]` 픽셀\n- 종횡비: 1:8 ~ 8:1\n- 파일 크기: `20MB` 이하", "example": "https://example.com/first_frame.jpg"},
          "image_end": {"type": "string", "format": "uri", "description": "종료 프레임 이미지 URL\n\n**모드 제약:**\n- `first_last_frame` 모드: **필수**\n- `video_continuation` 모드: 선택(연속의 종료 프레임으로 사용)\n- `first_frame` 모드: **전송 불가**(시작/종료가 모두 필요한 경우 `first_last_frame` 사용)\n\n**이미지 제한:**\n- 포맷: JPEG, JPG, PNG(투명도 미지원), BMP, WEBP\n- 해상도: 가로/세로가 `[240, 8000]` 픽셀\n- 종횡비: 1:8 ~ 8:1\n- 파일 크기: `20MB` 이하", "example": "https://example.com/last_frame.jpg"},
          "video_urls": {"type": "array", "items": {"type": "string", "format": "uri"}, "description": "동영상 연속 URL 배열. **1개 요소만 지원**\n\n**모드 제약:**\n- `video_continuation` 모드: **필수**\n- `first_frame` / `first_last_frame` 모드: **전송 불가**\n- `audio_urls`와 함께 사용 불가\n\n**동영상 제한:**\n- 포맷: mp4, mov\n- 길이: `2 ~ 10`초(입력 클립 자체의 길이)\n- 해상도: 가로/세로가 `[240, 4096]` 픽셀\n- 종횡비: 1:8 ~ 8:1\n- 파일 크기: `100MB` 이하\n\n**연속 길이 규칙:**\n- `duration`은 **최종 출력 동영상의 총 길이**를 의미(입력 클립 + 모델 생성 연속 부분)\n- 모델 생성 부분 길이 = `duration` − 입력 동영상 길이\n- `duration`은 입력 동영상 길이 이상이어야 함\n- 청구는 최종 출력 동영상 총 길이(즉 `duration`) 기준\n\n**예시:**\n\n| 입력 클립 길이 | duration | 생성 연속 | 최종 출력 | 청구 |\n| --- | --- | --- | --- | --- |\n| 3초 | 15 | 12초 | 15초 | 15초 |\n| 5초 | 10 | 5초 | 10초 | 10초 |\n| 8초 | 8 | 0초(입력만) | 8초 | 8초 |", "example": ["https://example.com/clip.mp4"]},
          "audio_urls": {"type": "array", "items": {"type": "string", "format": "uri"}, "minItems": 1, "maxItems": 1, "description": "구동 오디오 URL 배열. **현재 1개 요소만 지원**. 모델은 이 오디오를 구동 소스로 사용하여 동영상을 생성합니다(예: 립싱크, 모션 동기화)\n\n**모드 제약:**\n- `first_frame` 모드: 선택\n- `first_last_frame` 모드: 선택\n- `video_continuation` 모드: **전송 불가**(`video_urls`와 함께 사용 불가)\n\n**포맷 요구사항:**\n- 지원 포맷: `wav`, `mp3`\n- 길이: `2 ~ 30`초\n- 파일 크기: `15MB` 이하\n\n**잘림 처리:**\n- 오디오 길이가 `duration`을 초과하면 앞 N초만 사용하고 나머지는 폐기\n- 오디오 길이가 동영상 길이보다 짧으면 나머지 부분은 무음. 예: 오디오 3초, 동영상 5초인 경우 앞 3초는 유음, 뒤 2초는 무음", "example": ["https://example.com/audio.mp3"]},
          "quality": {"type": "string", "description": "동영상 품질, 기본값 `720p`\n\n**옵션:**\n- `720p`: 표준 화질, 표준 가격(기본)\n- `1080p`: 고화질, 가격 상승", "enum": ["720p", "1080p"], "default": "720p", "example": "720p"},
          "duration": {"type": "number", "description": "동영상 길이(초, 정수). 범위 `2 ~ 15`, 기본값 `5`\n\n**의미:**\n- `first_frame` / `first_last_frame` 모드: 생성 동영상의 총 길이\n- `video_continuation` 모드: 최종 출력 동영상의 총 길이(= 입력 클립 + 모델 생성 연속 부분)\n\n**`video_continuation` 모드의 추가 제약:**\n- `duration`은 **입력 동영상 길이 이상**이어야 함(아니면 오류 반환)\n- 모델 생성 부분 길이 = `duration` − 입력 동영상 길이\n- `duration`이 입력 동영상 길이와 같으면 연속이 생성되지 않고 입력 클립이 그대로 출력됨\n- 자세한 규칙과 예시는 `video_urls` 필드 참조\n\n**청구:** 실제 생성된 동영상 길이 기준", "minimum": 2, "maximum": 15, "default": 5, "example": 5},
          "seed": {"type": "integer", "description": "랜덤 시드, 기본값은 랜덤\n\n**설명:**\n- 범위: `1` ~ `2147483647`\n- 시드를 고정하면 프롬프트 반복 시 변동을 줄이고 재현성을 높입니다", "minimum": 1, "maximum": 2147483647, "example": 42},
          "prompt_extend": {"type": "boolean", "description": "프롬프트 지능 재작성 활성화 여부. 활성화 시 대형 모델이 프롬프트를 최적화하여 단순하거나 설명이 부족한 프롬프트의 결과를 크게 개선합니다.\n\n**참고:** 기본값은 `false`입니다. 필드를 생략하거나 `false`를 보내면 재작성이 발생하지 않습니다. 활성화하려면 명시적으로 `true`를 보내세요.", "default": false, "example": false},
          "callback_url": {"type": "string", "description": "작업 완료 시의 HTTPS 콜백 URL\n\n**콜백 시점:**\n- 작업 완료(completed), 실패(failed), 취소(cancelled) 시 트리거\n- 청구 확정 후 전송\n\n**보안 제약:**\n- HTTPS만 지원\n- 내부 IP 주소(127.0.0.1, 10.x.x.x, 172.16-31.x.x, 192.168.x.x 등)로의 콜백 금지\n- URL 길이는 `2048`자 이하\n\n**콜백 메커니즘:**\n- 타임아웃: `10`초\n- 실패 시 최대 `3`회 재시도(실패 후 `1`/`2`/`4`초 시점)\n- 콜백 응답 형식은 작업 조회 API와 동일\n- 2xx 상태 코드는 성공으로 간주, 그 외는 재시도 트리거", "format": "uri", "example": "https://your-domain.com/webhooks/video-task-completed"}
        }
      },
      "VideoGenerationResponse": {"type": "object", "properties": {"created": {"type": "integer", "description": "작업 생성 타임스탬프", "example": 1757169743}, "id": {"type": "string", "description": "작업 ID", "example": "task-unified-1757169743-7cvnl5zw"}, "model": {"type": "string", "description": "실제로 사용한 모델명", "example": "wan2.7-image-to-video"}, "object": {"type": "string", "enum": ["video.generation.task"], "description": "작업의 구체적인 종류"}, "progress": {"type": "integer", "description": "작업 진행률 (0-100)", "minimum": 0, "maximum": 100, "example": 0}, "status": {"type": "string", "description": "작업 상태", "enum": ["pending", "processing", "completed", "failed"], "example": "pending"}, "task_info": {"$ref": "#/components/schemas/VideoTaskInfo", "description": "동영상 작업 상세 정보"}, "type": {"type": "string", "enum": ["text", "image", "audio", "video"], "description": "작업 출력 유형", "example": "video"}, "usage": {"$ref": "#/components/schemas/Usage", "description": "사용량 및 청구 정보"}}},
      "VideoTaskInfo": {"type": "object", "properties": {"can_cancel": {"type": "boolean", "description": "작업 취소 가능 여부", "example": true}, "estimated_time": {"type": "integer", "description": "예상 완료 시간(초)", "minimum": 0, "example": 120}}},
      "Usage": {"type": "object", "description": "사용량 및 청구 정보", "properties": {"billing_rule": {"type": "string", "description": "청구 규칙", "enum": ["per_call", "per_token", "per_second"], "example": "per_call"}, "credits_reserved": {"type": "number", "description": "예상 소비 크레딧", "minimum": 0, "example": 5}, "user_group": {"type": "string", "description": "사용자가 속한 과금 그룹", "example": "default"}}},
      "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```"}}
  }
}
