> ## Documentation Index
> Fetch the complete documentation index at: https://docs.apimart.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# VEO3 공식 비디오 생성

>  - 비동기 처리 모드, 후속 쿼리를 위해 작업 ID를 반환합니다
- 텍스트-투-비디오, 이미지-투-비디오(첫 프레임/첫·끝 프레임 제어) 지원
- 720P 및 1080P 해상도 지원
- 4/6/8초 비디오 길이 지원
- 오디오 트랙 생성 지원
- 인물 생성 정책 제어 지원 

<RequestExample>
  ```bash cURL theme={null}
  curl --request POST \
    --url https://api.apimart.ai/v1/videos/generations \
    --header 'Authorization: Bearer <token>' \
    --header 'Content-Type: application/json' \
    --data '{
      "model": "veo3.1-fast-official",
      "prompt": "a golden retriever running on the beach, sunset, cinematic",
      "duration": 8,
      "aspect_ratio": "16:9"
    }'
  ```

  ```python Python theme={null}
  import requests

  url = "https://api.apimart.ai/v1/videos/generations"

  payload = {
      "model": "veo3.1-fast-official",
      "prompt": "a golden retriever running on the beach, sunset, cinematic",
      "duration": 8,
      "aspect_ratio": "16:9"
  }

  headers = {
      "Authorization": "Bearer <token>",
      "Content-Type": "application/json"
  }

  response = requests.post(url, json=payload, headers=headers)

  print(response.json())
  ```

  ```javascript JavaScript theme={null}
  const url = "https://api.apimart.ai/v1/videos/generations";

  const payload = {
    model: "veo3.1-fast-official",
    prompt: "a golden retriever running on the beach, sunset, cinematic",
    duration: 8,
    aspect_ratio: "16:9"
  };

  const headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
  };

  fetch(url, {
    method: "POST",
    headers: headers,
    body: JSON.stringify(payload)
  })
    .then(response => response.json())
    .then(data => console.log(data))
    .catch(error => console.error('Error:', error));
  ```

  ```go Go theme={null}
  package main

  import (
      "bytes"
      "encoding/json"
      "fmt"
      "io/ioutil"
      "net/http"
  )

  func main() {
      url := "https://api.apimart.ai/v1/videos/generations"

      payload := map[string]interface{}{
          "model":        "veo3.1-fast-official",
          "prompt":       "a golden retriever running on the beach, sunset, cinematic",
          "duration":     8,
          "aspect_ratio": "16:9",
      }

      jsonData, _ := json.Marshal(payload)

      req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
      req.Header.Set("Authorization", "Bearer <token>")
      req.Header.Set("Content-Type", "application/json")

      client := &http.Client{}
      resp, err := client.Do(req)
      if err != nil {
          panic(err)
      }
      defer resp.Body.Close()

      body, _ := ioutil.ReadAll(resp.Body)
      fmt.Println(string(body))
  }
  ```

  ```java Java theme={null}
  import java.net.http.HttpClient;
  import java.net.http.HttpRequest;
  import java.net.http.HttpResponse;
  import java.net.URI;

  public class Main {
      public static void main(String[] args) throws Exception {
          String url = "https://api.apimart.ai/v1/videos/generations";

          String payload = """
          {
            "model": "veo3.1-fast-official",
            "prompt": "a golden retriever running on the beach, sunset, cinematic",
            "duration": 8,
            "aspect_ratio": "16:9"
          }
          """;

          HttpClient client = HttpClient.newHttpClient();
          HttpRequest request = HttpRequest.newBuilder()
              .uri(URI.create(url))
              .header("Authorization", "Bearer <token>")
              .header("Content-Type", "application/json")
              .POST(HttpRequest.BodyPublishers.ofString(payload))
              .build();

          HttpResponse<String> response = client.send(request,
              HttpResponse.BodyHandlers.ofString());

          System.out.println(response.body());
      }
  }
  ```

  ```php PHP theme={null}
  <?php

  $url = "https://api.apimart.ai/v1/videos/generations";

  $payload = [
      "model" => "veo3.1-fast-official",
      "prompt" => "a golden retriever running on the beach, sunset, cinematic",
      "duration" => 8,
      "aspect_ratio" => "16:9"
  ];

  $ch = curl_init($url);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  curl_setopt($ch, CURLOPT_POST, true);
  curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));
  curl_setopt($ch, CURLOPT_HTTPHEADER, [
      "Authorization: Bearer <token>",
      "Content-Type: application/json"
  ]);

  $response = curl_exec($ch);
  curl_close($ch);

  echo $response;
  ?>
  ```

  ```ruby Ruby theme={null}
  require 'net/http'
  require 'json'
  require 'uri'

  url = URI("https://api.apimart.ai/v1/videos/generations")

  payload = {
    model: "veo3.1-fast-official",
    prompt: "a golden retriever running on the beach, sunset, cinematic",
    duration: 8,
    aspect_ratio: "16:9"
  }

  http = Net::HTTP.new(url.host, url.port)
  http.use_ssl = true

  request = Net::HTTP::Post.new(url)
  request["Authorization"] = "Bearer <token>"
  request["Content-Type"] = "application/json"
  request.body = payload.to_json

  response = http.request(request)
  puts response.body
  ```

  ```swift Swift theme={null}
  import Foundation

  let url = URL(string: "https://api.apimart.ai/v1/videos/generations")!

  let payload: [String: Any] = [
      "model": "veo3.1-fast-official",
      "prompt": "a golden retriever running on the beach, sunset, cinematic",
      "duration": 8,
      "aspect_ratio": "16:9"
  ]

  var request = URLRequest(url: url)
  request.httpMethod = "POST"
  request.setValue("Bearer <token>", forHTTPHeaderField: "Authorization")
  request.setValue("application/json", forHTTPHeaderField: "Content-Type")
  request.httpBody = try? JSONSerialization.data(withJSONObject: payload)

  let task = URLSession.shared.dataTask(with: request) { data, response, error in
      if let error = error {
          print("Error: \(error)")
          return
      }

      if let data = data, let responseString = String(data: data, encoding: .utf8) {
          print(responseString)
      }
  }

  task.resume()
  ```

  ```csharp C# theme={null}
  using System;
  using System.Net.Http;
  using System.Text;
  using System.Threading.Tasks;

  class Program
  {
      static async Task Main(string[] args)
      {
          var url = "https://api.apimart.ai/v1/videos/generations";

          var payload = @"{
              ""model"": ""veo3.1-fast-official"",
              ""prompt"": ""a golden retriever running on the beach, sunset, cinematic"",
              ""duration"": 8,
              ""aspect_ratio"": ""16:9""
          }";

          using var client = new HttpClient();
          client.DefaultRequestHeaders.Add("Authorization", "Bearer <token>");

          var content = new StringContent(payload, Encoding.UTF8, "application/json");
          var response = await client.PostAsync(url, content);
          var result = await response.Content.ReadAsStringAsync();

          Console.WriteLine(result);
      }
  }
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "code": 200,
    "data": [
      {
        "status": "submitted",
        "task_id": "task_xxxxxxxxxx"
      }
    ]
  }
  ```

  ```json 400 theme={null}
  {
    "error": {
      "code": 400,
      "message": "요청 매개변수가 유효하지 않습니다",
      "type": "invalid_request_error"
    }
  }
  ```

  ```json 401 theme={null}
  {
    "error": {
      "code": 401,
      "message": "인증에 실패했습니다. API 키를 확인해 주세요",
      "type": "authentication_error"
    }
  }
  ```

  ```json 402 theme={null}
  {
    "error": {
      "code": 402,
      "message": "계정 잔액이 부족합니다. 충전 후 다시 시도해 주세요",
      "type": "payment_required"
    }
  }
  ```

  ```json 429 theme={null}
  {
    "error": {
      "code": 429,
      "message": "요청이 너무 빈번합니다. 잠시 후 다시 시도해 주세요",
      "type": "rate_limit_error"
    }
  }
  ```

  ```json 500 theme={null}
  {
    "error": {
      "code": 500,
      "message": "서버 내부 오류, 잠시 후 다시 시도해 주세요",
      "type": "server_error"
    }
  }
  ```
</ResponseExample>

## 인증

<ParamField header="Authorization" type="string" required>
  모든 API 엔드포인트에서 Bearer Token 인증이 필요합니다

  API Key 획득:

  [API Key 관리 페이지](https://apimart.ai/keys)에 접속하여 API Key를 획득하세요

  사용 시 요청 헤더에 추가:

  ```
  Authorization: Bearer YOUR_API_KEY
  ```
</ParamField>

## 요청 파라미터

<ParamField body="model" type="string" required>
  비디오 생성 모델명

  사용 가능한 모델:

  * `veo3.1-fast-official` - Veo 3.1 공식 빠른 버전
  * `veo3.1-quality-official` - Veo 3.1 공식 고품질 버전
</ParamField>

<ParamField body="prompt" type="string" required>
  긍정 텍스트 프롬프트

  장면, 동작, 스타일 등을 자세히 설명하면 더 좋은 생성 결과를 얻을 수 있습니다. 영어 프롬프트 사용을 권장합니다.

  예시: `"a golden retriever running on the beach, sunset, cinematic"`
</ParamField>

<ParamField body="negative_prompt" type="string">
  원하지 않는 콘텐츠를 제외하기 위한 부정 프롬프트

  예시: `"blurry, low quality, watermark, text"`
</ParamField>

<ParamField body="duration" type="integer" default="8">
  비디오 길이(초)

  권장값: `4` / `6` / `8`

  기본값: `8`

  **⚠️ 주의:** 순수 숫자(예: `8`)를 입력해야 합니다. 따옴표를 추가하면 오류가 발생합니다
</ParamField>

<ParamField body="aspect_ratio" type="string" default="16:9">
  비디오 화면 비율

  선택 가능한 값:

  * `16:9` - 가로
  * `9:16` - 세로

  기본값: `16:9`
</ParamField>

<ParamField body="resolution" type="string" default="720p">
  비디오 해상도

  선택 가능한 값:

  * `720p` - 표준 해상도
  * `1080p` - 고화질
  * `4K` - 초고화질

  기본값: `720p`
</ParamField>

<ParamField body="first_frame_image" type="string">
  첫 프레임 이미지 URL, 이미지-투-비디오 생성에 사용

  <Warning>
    * 이미지 URL은 공개 접근 가능하고 핫링크 보호가 없어야 합니다
    * 임시 다운로드 링크 대신 오브젝트 스토리지 URL 사용을 권장합니다
  </Warning>
</ParamField>

<ParamField body="last_frame_image" type="string">
  끝 프레임 이미지 URL, 이미지-투-비디오 생성에 사용

  `first_frame_image`와 함께 사용하여 첫·끝 프레임 제어를 구현합니다
</ParamField>

<ParamField body="seed" type="integer">
  생성 결과를 재현하기 위한 랜덤 시드

  값 범위: `0` - `4294967295`
</ParamField>

<ParamField body="sample_count" type="integer" default="1">
  생성 샘플 수 1-4, 현재 `1` 사용을 권장

  기본값: `1`
</ParamField>

<ParamField body="generate_audio" type="boolean" default="false">
  오디오 트랙 생성 여부
</ParamField>

<ParamField body="person_generation" type="string" default="allow_adult">
  인물 생성 정책

  선택 가능한 값:

  * `allow_adult` - 성인 인물/얼굴 생성만 허용
  * `disallow` - 인물 또는 얼굴 생성을 허용하지 않음

  기본값: `allow_adult`
</ParamField>

<ParamField body="resize_mode" type="string" default="pad">
  이미지 리사이즈 전략(이미지-투-비디오 시 적용)

  선택 가능한 값:

  * `pad` - 패딩 모드
  * `crop` - 크롭 모드

  기본값: `pad`
</ParamField>

<ParamField body="enhance_prompt" type="boolean" default="true">
  업스트림 프롬프트 강화 활성화 여부

  기본값: `true`

  <Warning>
    * 이 매개변수는 `true`로만 설정할 수 있습니다. `false`로 설정하면 요청 오류가 발생합니다
    * 이 매개변수가 필요하지 않은 경우 전송하지 마세요
  </Warning>
</ParamField>

## 텍스트-투-비디오 vs 이미지-투-비디오

시스템은 이미지 매개변수 전달 여부로 자동으로 모드를 판단합니다: 이미지 없으면 텍스트-투-비디오, 이미지 있으면 이미지-투-비디오.

| 매개변수                | 텍스트-투-비디오 | 이미지-투-비디오      |
| ------------------- | --------- | -------------- |
| `prompt`            | ✅ 필수      | ✅ 필수           |
| `first_frame_image` | ❌ 불필요     | ✅ 최소 하나 필요     |
| `last_frame_image`  | ❌ 불필요     | ✅ 선택 사항(끝 프레임) |
| `negative_prompt`   | ✅ 선택 사항   | ✅ 선택 사항        |
| `duration`          | ✅ 선택 사항   | ✅ 선택 사항        |
| `aspect_ratio`      | ✅ 선택 사항   | ✅ 선택 사항        |
| `resolution`        | ✅ 선택 사항   | ✅ 선택 사항        |
| `seed`              | ✅ 선택 사항   | ✅ 선택 사항        |
| `generate_audio`    | ✅ 선택 사항   | ✅ 선택 사항        |
| `person_generation` | ✅ 선택 사항   | ✅ 선택 사항        |
| `resize_mode`       | ❌ 해당 없음   | ✅ 선택 사항        |
| `enhance_prompt`    | ✅ 선택 사항   | ✅ 선택 사항        |

## 응답

<ResponseField name="code" type="integer">
  응답 상태 코드, 성공 시 200
</ResponseField>

<ResponseField name="data" type="array">
  응답 데이터 배열

  <Expandable title="속성">
    <ResponseField name="status" type="string">
      작업 상태, 제출 시 초기값은 `submitted`
    </ResponseField>

    <ResponseField name="task_id" type="string">
      작업 고유 식별자, 작업 상태 및 결과 조회에 사용
    </ResponseField>
  </Expandable>
</ResponseField>

## 사용 시나리오

### 시나리오 1: 텍스트-투-비디오(기본)

```json theme={null}
{
  "model": "veo3.1-fast-official",
  "prompt": "a golden retriever running on the beach, sunset, cinematic"
}
```

### 시나리오 2: 텍스트-투-비디오(전체 매개변수)

```json theme={null}
{
  "model": "veo3.1-quality-official",
  "prompt": "a cinematic close-up of a ragdoll cat slowly walking through a sunlit living room",
  "negative_prompt": "blurry, low quality, watermark, text",
  "duration": 8,
  "aspect_ratio": "16:9",
  "resolution": "1080p",
  "seed": 12345,
  "generate_audio": true,
  "person_generation": "disallow",
  "enhance_prompt": true
}
```

### 시나리오 3: 이미지-투-비디오(첫 프레임 1장)

```json theme={null}
{
  "model": "veo3.1-fast-official",
  "prompt": "the cat slowly walks forward and looks around",
  "first_frame_image": "https://example.com/cat.png",
  "duration": 8,
  "resolution": "720p"
}
```

### 시나리오 4: 이미지-투-비디오(첫 프레임 + 끝 프레임)

```json theme={null}
{
  "model": "veo3.1-quality-official",
  "prompt": "smooth cinematic transition from the first frame to the last frame",
  "first_frame_image": "https://example.com/frame-start.png",
  "last_frame_image": "https://example.com/frame-end.png",
  "duration": 8,
  "resolution": "1080p"
}
```

### 시나리오 5: 오디오 포함 비디오 생성

```json theme={null}
{
  "model": "veo3.1-quality-official",
  "prompt": "a busy coffee shop with people chatting and barista making latte art",
  "duration": 8,
  "generate_audio": true,
  "aspect_ratio": "16:9"
}
```

<Note>
  **작업 결과 조회**

  비디오 생성은 비동기 작업으로, 제출 후 `task_id`가 반환됩니다. [작업 상태 조회](/ko/api-reference/tasks/status) 엔드포인트를 사용하여 생성 진행 상황과 결과를 조회하세요.
</Note>
