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

# Create Kling speech

> Call Kling TTS via CometAPI POST /kling/v1/audio/tts to convert text to speech with multilingual voices, plus fixes for voice_id not found errors.

## TTS

The Kling TTS (Text-to-Speech) API provides high-quality text-to-speech services, supporting multiple languages and voice options.

### Reference documentation

* **API Reference**: [Kling TTS API Documentation](https://app.klingai.com/global/dev/document-api/apiReference/model/TTS)
* **Voice ID List**: [Available Voice ID Reference](https://docs.qingque.cn/s/home/eZQDvafJ4vXQkP8T9ZPvmye8S?identityId=2E1MlYrrPk4)

***

## Common issues

### Voice id not found error

**Issue Description**: When `voice_id` does not match `voice_language`, the API will return the following error:

```json theme={null}
{
  "message": "Voice id not found",
  "data": {
    "data": {
      "code": 1201,
      "message": "Voice id not found",
      "request_id": "ed47a82c-804b-45f3-bde9-926039cd25c0"
    },
    "message": "Voice id not found"
  }
}
```

**Solution**: Please ensure that the selected `voice_id` supports your specified `voice_language`. Refer to the [Voice ID List](https://docs.qingque.cn/s/home/eZQDvafJ4vXQkP8T9ZPvmye8S?identityId=2E1MlYrrPk4) to check which languages each voice ID supports.


## OpenAPI

````yaml api/openapi/video/kling/post-tts.openapi.json POST /kling/v1/audio/tts
openapi: 3.1.0
info:
  title: TTS API
  version: 1.0.0
servers:
  - url: https://api.cometapi.com
security:
  - bearerAuth: []
paths:
  /kling/v1/audio/tts:
    post:
      summary: TTS
      operationId: tts
      parameters:
        - name: Content-Type
          in: header
          required: false
          description: Content type of the request body.
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - text
                - voice_id
                - voice_language
              properties:
                text:
                  type: string
                  description: Text to synthesize into speech. Max 1000 characters.
                voice_id:
                  type: string
                  description: >-
                    Voice preset ID. Determines the speaker voice used for
                    synthesis. See the Kling documentation for available voice
                    IDs and their supported languages.
                voice_language:
                  type: string
                  description: >-
                    Language of the selected voice. Must match the language
                    supported by the chosen `voice_id`. Values: `zh` (Chinese)
                    or `en` (English).
                voice_speed:
                  type: number
                  description: >-
                    Speech rate multiplier. Range 0.8–2.0 (one decimal place).
                    Values outside this range are clamped automatically.
              default:
                text: Welcome to CometAPI!
                voice_id: genshin_vindi2
                voice_language: zh
            examples:
              Example 1:
                summary: Example 1
                value:
                  text: Welcome to CometAPI!
                  voice_id: genshin_vindi2
                  voice_language: zh
                  voice_speed: 1.2
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                type: object
                required:
                  - code
                  - message
                  - data
                properties:
                  code:
                    type: integer
                    description: Response code. `0` means the task request was accepted.
                  message:
                    type: string
                    description: Response message.
                  request_id:
                    type: string
                    description: Request identifier returned by CometAPI when present.
                  data:
                    type: object
                    required:
                      - task_id
                      - task_status
                      - created_at
                      - updated_at
                    properties:
                      task_id:
                        type: string
                        description: Task ID generated by the system.
                      task_status:
                        type: string
                        description: Task status.
                        enum:
                          - submitted
                          - processing
                          - succeed
                          - failed
                      task_info:
                        type: object
                        additionalProperties: true
                      task_status_msg:
                        type:
                          - string
                          - 'null'
                      created_at:
                        type: integer
                        description: >-
                          Task creation time as a Unix timestamp in
                          milliseconds.
                      updated_at:
                        type: integer
                        description: Task update time as a Unix timestamp in milliseconds.
                    additionalProperties: true
                additionalProperties: true
                example:
                  code: 0
                  message: SUCCEED
                  data:
                    task_id: <task_id>
                    task_status: submitted
                    task_info: {}
                    task_status_msg: null
                    created_at: 1773366840306
                    updated_at: 1773366840306
      x-codeSamples:
        - lang: Shell
          label: Default
          source: |
            curl https://api.cometapi.com/kling/v1/audio/tts \
              -H "Authorization: Bearer $COMETAPI_KEY" \
              -H "Content-Type: application/json" \
              -d '{
                  "text": "Welcome to CometAPI!",
                  "voice_id": "genshin_vindi2",
                  "voice_language": "zh",
                  "voice_speed": 1.2
                }'
        - lang: Python
          label: Default
          source: >
            import os

            import requests


            response = requests.post(
                "https://api.cometapi.com/kling/v1/audio/tts",
                headers={"Authorization": "Bearer " + os.environ["COMETAPI_KEY"]},
                json={
                        "text": "Welcome to CometAPI!",
                        "voice_id": "genshin_vindi2",
                        "voice_language": "zh",
                        "voice_speed": 1.2
                },
            )


            result = response.json()

            print(result["code"], result.get("data", {}).get("task_id"))  # the
            route responds with the result payload directly
        - lang: JavaScript
          label: Default
          source: >
            const response = await
            fetch("https://api.cometapi.com/kling/v1/audio/tts", {
                method: "POST",
                headers: {
                    Authorization: `Bearer ${process.env.COMETAPI_KEY}`,
                    "Content-Type": "application/json",
                },
                body: JSON.stringify({
                        "text": "Welcome to CometAPI!",
                        "voice_id": "genshin_vindi2",
                        "voice_language": "zh",
                        "voice_speed": 1.2
                    }),
            });


            const result = await response.json();

            console.log(result.code, result.data?.task_id); // the route
            responds with the result payload directly
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: Bearer token authentication. Use your CometAPI key.

````