# "Gửi tác vụ tạo video"

Nguồn: https://docs.openaihub.net/api-45208978/

> API origin: `https://api.openaihub.net`. Chọn đúng nhóm API và model. Thông số dưới đây là bản tham chiếu kỹ thuật; chưa phải kết quả kiểm thử từng endpoint bằng tài khoản của bạn.


## OpenAPI Specification

```yaml
openapi: 3.0.1
info:
  title: ''
  description: ''
  version: 1.0.0
paths:
  /luma/generations:
    post:
      summary: Gửi tác vụ tạo video
      deprecated: false
      description: >-
        Video tạo từ văn bản hoặc video tạo từ hình ảnh. Hỗ trợ hai định dạng
        yêu cầu:

        - **Định dạng chính thức**: `prompt` + `keyframes`

        - **Định dạng proxy**: `user_prompt` + `image_url`


        Tài liệu chính thức: https://docs.lumalabs.ai/docs/video-generation
      operationId: luma_sample
      tags:
        - OpenAiHub Việt Nam/OpenAiHub Tiếng Việt/Video/Luma/Định dạng API chính thức
        - Luma
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              type: object
              required:
                - user_prompt
              properties:
                duration:
                  type: string
                  description: Thời lượng chỉ hỗ trợ 5 giây
                expand_prompt:
                  type: boolean
                  description: Tùy chọn, công tắc tối ưu hóa từ ngữ trong lời nhắc
                image_end_url:
                  type: string
                  description: Tùy chọn, ảnh khung hình chính mục tiêu
                image_url:
                  type: string
                  description: Tùy chọn, tham khảo nguồn hình ảnh
                loop:
                  type: boolean
                  description: Tùy chọn, có tái sử dụng hình ảnh tham chiếu hay không
                model_name:
                  type: string
                  description: Cách hiển thị chính thức của ray-v1 và ray-v2 là ray1.6 ray2
                notify_hook:
                  type: string
                  description: >-
                    Tùy chọn, địa chỉ thông báo callback sau khi quá trình xử lý
                    hoàn tất
                resolution:
                  type: string
                  description: 720p hoặc 1080p, mặc định là 720p
                user_prompt:
                  type: string
                  description: Bắt buộc, từ trong lời nhắc/mô tả vấn đề do người dùng nhập
              refName: LumaSampleRequest
              x-apifox-orders:
                - duration
                - expand_prompt
                - image_end_url
                - image_url
                - loop
                - model_name
                - notify_hook
                - resolution
                - user_prompt
              x-apidog-orders:
                - duration
                - expand_prompt
                - image_end_url
                - image_url
                - loop
                - model_name
                - notify_hook
                - resolution
                - user_prompt
            examples:
              example_single:
                value:
                  duration: 5s
                  model_name: ray-v2
                  resolution: 720p
                  user_prompt: >-
                    Một cơn gió thổi qua khu rừng, khiến tấm mạng che mặt của
                    người phụ nữ khẽ lay động.
                summary: example_single
                description: Gửi tác vụ tạo video
              image2video:
                value:
                  aspect_ratio: '16:9'
                  image_url: https://example.com/start-frame.jpg
                  user_prompt: Khung cảnh trở nên sống động với làn gió nhẹ
                summary: image2video
                description: video từ ảnh
              text2video:
                value:
                  aspect_ratio: '16:9'
                  expand_prompt: true
                  user_prompt: >-
                    Một con đại bàng oai vệ bay lượn trên những ngọn núi phủ
                    tuyết vào lúc hoàng hôn
                summary: text2video
                description: Video Vincent
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  batch_id:
                    type: string
                    description: Mã lô
                  created_at:
                    type: string
                    format: date-time
                    description: Thời gian tạo
                  estimate_wait_seconds:
                    type: integer
                    description: >-
                      Thời gian chờ ước tính (giây) Thời gian chờ ước tính
                      (giây)
                    nullable: true
                  id:
                    type: string
                    description: Mã tác vụ Mã tác vụ
                  last_frame:
                    type: object
                    properties:
                      url:
                        type: string
                        description: URL tài nguyên
                    description: URL hình ảnh của khung hình cuối
                    x-apifox-orders:
                      - url
                    x-apidog-orders:
                      - url
                    nullable: true
                  prompt:
                    type: string
                    description: Các từ dùng trong lời nhắc Các từ dùng trong lời nhắc
                  queue_state:
                    type: string
                    description: Trạng thái hàng đợi
                    nullable: true
                  state:
                    type: string
                    enum:
                      - queued
                      - pending
                      - processing
                      - completed
                      - failed
                    description: trạng thái tác vụ trạng thái tác vụ
                  thumbnail:
                    type: object
                    properties:
                      url:
                        type: string
                        description: URL tài nguyên
                    description: URL hình thu nhỏ
                    x-apifox-orders:
                      - url
                    x-apidog-orders:
                      - url
                    nullable: true
                  video:
                    type: object
                    properties:
                      height:
                        type: integer
                        description: Chiều cao (pixel)
                      url:
                        type: string
                        description: Tạo URL video (khả dụng khi state=completed)
                      width:
                        type: integer
                        description: Chiều rộng (pixel)
                    description: URL hoặc mã định danh video
                    x-apifox-orders:
                      - height
                      - url
                      - width
                    x-apidog-orders:
                      - height
                      - url
                      - width
                    nullable: true
                refName: LumaGenerationResponse
                x-apifox-orders:
                  - batch_id
                  - created_at
                  - estimate_wait_seconds
                  - id
                  - last_frame
                  - prompt
                  - queue_state
                  - state
                  - thumbnail
                  - video
                x-apidog-orders:
                  - batch_id
                  - created_at
                  - estimate_wait_seconds
                  - id
                  - last_frame
                  - prompt
                  - queue_state
                  - state
                  - thumbnail
                  - video
              examples:
                example:
                  summary: example
                  value:
                    batch_id: ''
                    created_at: '2024-12-22T13:38:40.139Z'
                    id: 4665a07c-7641-4809-a133-10786201bb56
                    prompt: ''
                    state: đang chờ
          headers: {}
          x-apidog-name: ''
        '400':
          description: Yêu cầu không hợp lệ hoặc xác thực thất bại
          content:
            application/json:
              schema:
                type: object
                required:
                  - error
                properties:
                  error:
                    type: object
                    required:
                      - message
                      - type
                    properties:
                      message:
                        type: string
                        description: Thông báo lỗi (thường kết thúc bằng mã yêu cầu)
                      type:
                        type: string
                        description: Loại lỗi; các lỗi cổng cục bộ thường là new_api_error
                        examples:
                          - new_api_error
                    x-apifox-orders:
                      - message
                      - type
                    x-apidog-orders:
                      - message
                      - type
                refName: NewApiError
                x-apifox-orders:
                  - error
                x-apidog-orders:
                  - error
              examples:
                example:
                  summary: example
                  value:
                    error:
                      message: >-
                        Yêu cầu không hợp lệ (mã yêu cầu:
                        20260805120000123456789AbCdEfGh)
                      type: new_api_error
          headers: {}
          x-apidog-name: Yêu cầu không hợp lệ hoặc xác thực thất bại
        '401':
          description: Khóa API bị thiếu hoặc không hợp lệ
          content:
            application/json:
              schema:
                type: object
                required:
                  - error
                properties:
                  error:
                    type: object
                    required:
                      - message
                      - type
                    properties:
                      message:
                        type: string
                        description: Thông báo lỗi (thường kết thúc bằng mã yêu cầu)
                      type:
                        type: string
                        description: Loại lỗi; các lỗi cổng cục bộ thường là new_api_error
                        examples:
                          - new_api_error
                    x-apifox-orders:
                      - message
                      - type
                    x-apidog-orders:
                      - message
                      - type
                refName: NewApiError
                x-apifox-orders:
                  - error
                x-apidog-orders:
                  - error
              examples:
                example:
                  summary: example
                  value:
                    error:
                      message: >-
                        Mã thông báo không hợp lệ (request id:
                        20260805120000123456789AbCdEfGh)
                      type: new_api_error
          headers: {}
          x-apidog-name: Khóa API bị thiếu hoặc không hợp lệ
      security: []
      x-apidog-folder: OpenAiHub Việt Nam/OpenAiHub Tiếng Việt/Video/Luma/Định dạng API chính thức
      x-apidog-status: released
      x-run-in-apidog: https://app.apidog.com/web/project/1218648/apis/api-45208978-run
components:
  schemas: {}
  securitySchemes: {}
servers:
  - url: https://api.openaihub.net
    description: Prod Env
security: []

```
