# "Tạo một vai trò"

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

> 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:
  /sora/v1/characters:
    post:
      summary: Tạo một vai trò
      deprecated: false
      description: Tạo các nhân vật có thể tái sử dụng từ cảnh quay video.
      operationId: sora_sample
      tags:
        - OpenAiHub Việt Nam/OpenAiHub Tiếng Việt/Video/sora
        - Sora2
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              type: object
              required:
                - timestamps
              properties:
                from_task:
                  type: string
                  description: Có thể tạo vai trò dựa trên mã định danh tác vụ đã được tạo
                timestamps:
                  type: string
                  description: >-
                    Đơn vị là giây, ví dụ, ‘1,2’ chỉ các ký tự xuất hiện từ giây
                    thứ 1 đến giây thứ 2 của video. Lưu ý rằng độ chênh lệch của
                    khoảng tối đa là 3 giây và tối thiểu là 1 giây.
                url:
                  type: string
                  description: >-
                    Video chứa vai trò cần được tạo; hãy chọn một trong hai:
                    `url` hoặc `from_task`.
              refName: SoraSampleRequest
              x-apifox-orders:
                - from_task
                - timestamps
                - url
              x-apidog-orders:
                - from_task
                - timestamps
                - url
            examples:
              default:
                value:
                  timestamps: 1,3
                  url: https://example.com/video.mp4
                summary: default
                description: Tạo từ URL
              example_single:
                value:
                  from_task: video_e50c76ca-21d4-40e9-8485-e4ead2d37133
                  timestamps: 1,3
                summary: example_single
                description: Tạo một vai trò
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                required:
                  - id
                  - username
                  - permalink
                  - profile_picture_url
                properties:
                  id:
                    type: string
                    description: id vai trò
                  permalink:
                    type: string
                    description: >-
                      Trang chủ nhân vật, chuyển đến để mở trang chủ nhân vật
                      openai
                  profile_picture_url:
                    type: string
                    description: Hình đại diện nhân vật
                  username:
                    type: string
                    description: Tên vai trò, được dùng trong từ khóa lời nhắc @{username}
                refName: SoraSampleResponse
                x-apifox-orders:
                  - id
                  - permalink
                  - profile_picture_url
                  - username
                x-apidog-orders:
                  - id
                  - permalink
                  - profile_picture_url
                  - username
              examples:
                example:
                  summary: example
                  value:
                    id: ch_6918d62178e48191a0b1ae49be428a13
                    permalink: https://sora.chatgpt.com/profile/hfspncadz.mooflapand
                    profile_picture_url: >-
                      Tôi không thể truy cập nội dung từ liên kết này. Vui lòng
                      dán tài liệu cần dịch vào đây.
                    username: hfspncadz.mooflapand
          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/sora
      x-apidog-status: released
      x-run-in-apidog: https://app.apidog.com/web/project/1218648/apis/api-45209052-run
components:
  schemas: {}
  securitySchemes: {}
servers:
  - url: https://api.openaihub.net
    description: Prod Env
security: []

```
