# "gemini-tts chuyển văn bản thành giọng nói"

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

> 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:
  /v1beta/models/gemini-2.5-pro-preview-tts:generateContent:
    post:
      summary: gemini-tts chuyển văn bản thành giọng nói
      deprecated: false
      description: >-
        Vui lòng cung cấp nội dung tài liệu cần dịch. Tôi không thể truy cập
        trực tiếp nội dung từ URL đã cung cấp.
      operationId: gemini_v1beta_2_5_pro_preview_tts_generate_content
      tags:
        - OpenAiHub Việt Nam/OpenAiHub Tiếng Việt/Trò chuyện/Gemini/Định dạng gốc
        - Gemini v1beta
      parameters:
        - name: key
          in: query
          description: 'Khóa API (cũng hỗ trợ Authorization: Bearer)'
          required: true
          example: '{{YOUR_API_KEY}}'
          schema:
            type: string
        - name: Content-Type
          in: header
          description: Loại nội dung của phần thân yêu cầu, thường là application/json
          required: true
          example: application/json
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              type: object
              required:
                - contents
                - generationConfig
              properties:
                contents:
                  type: array
                  items:
                    type: object
                    properties:
                      parts:
                        type: array
                        items:
                          type: object
                          properties:
                            text:
                              type: string
                              description: Nội dung văn bản để tổng hợp thành giọng nói
                          description: Phần văn bản
                          x-apifox-orders:
                            - text
                          x-apidog-orders:
                            - text
                        description: Các phần nội dung; TTS sử dụng văn bản
                    description: Nội dung một lượt
                    x-apifox-orders:
                      - parts
                    x-apidog-orders:
                      - parts
                  description: >-
                    Nội dung cuộc trò chuyện; cung cấp văn bản để đọc trong
                    parts.text
                generationConfig:
                  type: object
                  required:
                    - responseModalities
                    - speechConfig
                  properties:
                    responseModalities:
                      type: array
                      items:
                        type: string
                        description: Tên phương thức, thường là AUDIO
                      description: >-
                        Các phương thức phản hồi; đối với TTS, hãy sử dụng
                        ["AUDIO"]
                    speechConfig:
                      type: object
                      required:
                        - voiceConfig
                      properties:
                        voiceConfig:
                          type: object
                          required:
                            - prebuiltVoiceConfig
                          properties:
                            prebuiltVoiceConfig:
                              type: object
                              required:
                                - voiceName
                              properties:
                                voiceName:
                                  type: string
                                  description: >-
                                    Tên giọng nói cài sẵn, ví dụ: Kore, Puck,
                                    Charon, Fenrir, Aoede
                              description: >-
                                Vui lòng cung cấp nội dung tài liệu kỹ thuật cần
                                dịch.
                              x-apifox-orders:
                                - voiceName
                              x-apidog-orders:
                                - voiceName
                          description: Cấu hình giọng nói; chỉ định tên giọng nói định sẵn
                          x-apifox-orders:
                            - prebuiltVoiceConfig
                          x-apidog-orders:
                            - prebuiltVoiceConfig
                      description: Cấu hình tổng hợp giọng nói
                      x-apifox-orders:
                        - voiceConfig
                      x-apidog-orders:
                        - voiceConfig
                  description: >-
                    Cấu hình tạo; phải bao gồm phương thức AUDIO và cấu hình
                    giọng nói
                  x-apifox-orders:
                    - responseModalities
                    - speechConfig
                  x-apidog-orders:
                    - responseModalities
                    - speechConfig
              refName: PostV1betaModelsGemini25ProPreviewTtsGenerateContentRequest
              description: >-
                Nội dung yêu cầu chuyển văn bản thành giọng nói của Gemini 2.5
                Pro Preview TTS
              x-apifox-orders:
                - contents
                - generationConfig
              x-apidog-orders:
                - contents
                - generationConfig
            examples:
              gemini_tts_single:
                value:
                  contents:
                    - parts:
                        - text: Chúc bạn một ngày thật tuyệt vời!
                  generationConfig:
                    responseModalities:
                      - ÂM THANH
                    speechConfig:
                      voiceConfig:
                        prebuiltVoiceConfig:
                          voiceName: Kore
                summary: gemini_tts_single
                description: gemini-tts chuyển văn bản thành giọng nói
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                x-apidog-orders: []
              examples:
                example:
                  summary: example
                  value:
                    candidates:
                      - content:
                          parts:
                            - inlineData:
                                data: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...
                                mimeType: audio/L16;codec=pcm;rate=24000
                          role: mô hình
                        finishReason: DỪNG LẠI
                        index: 0
                        safetyRatings: []
                    modelVersion: gemini-2.5-pro-preview-tts
                    promptFeedback:
                      safetyRatings: []
                    responseId: nXxoaf7mPM6j_uMPyICzkQo
                    usageMetadata:
                      candidatesTokenCount: 51
                      promptTokenCount: 9
                      promptTokensDetails:
                        - modality: Vui lòng cung cấp nội dung tài liệu cần dịch.
                          tokenCount: 9
                      thoughtsTokenCount: 0
                      totalTokenCount: 60
          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/Trò chuyện/Gemini/Định dạng gốc
      x-apidog-status: released
      x-run-in-apidog: https://app.apidog.com/web/project/1218648/apis/api-45208844-run
components:
  schemas: {}
  securitySchemes: {}
servers:
  - url: https://api.openaihub.net
    description: Prod Env
security: []

```
