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

# Generate speech: Create task

> Creates a Suno task: `model` picks the endpoint, the parameters go in `input`, and the optional `callBackUrl` receives a completion callback. On success `data.taskId` is returned and the task runs asynchronously; poll the query endpoint for the result. Every response has HTTP status 200; check `code`.



## OpenAPI

````yaml /openapi/en/suno-speech.json post /api/v1/jobs/createTask
openapi: 3.1.0
info:
  description: >-
    Create spoken audio with tone, rhythm, emotion and optional background
    music: simple mode takes one line describing the scene, advanced mode takes
    the script to speak plus tone, variety, vocal gender and background music;
    each request makes two clips.
  title: Suno Generate speech
  version: v1
servers:
  - url: https://api.dreamto.ai
security:
  - bearerAuth: []
tags:
  - name: Suno Generate speech
paths:
  /api/v1/jobs/createTask:
    post:
      tags:
        - Suno Generate speech
      summary: Create task
      description: >-
        Creates a Suno task: `model` picks the endpoint, the parameters go in
        `input`, and the optional `callBackUrl` receives a completion callback.
        On success `data.taskId` is returned and the task runs asynchronously;
        poll the query endpoint for the result. Every response has HTTP status
        200; check `code`.
      operationId: sunoCreateTask
      requestBody:
        content:
          application/json:
            examples:
              Simple mode:
                description: >-
                  `customMode: false`: one line describing the scene; the model
                  writes the script.
                summary: Simple mode
                value:
                  model: ai-music-api/speech
                  input:
                    customMode: false
                    prompt: A short morning news intro about sunny weather
              Advanced mode:
                description: >-
                  `customMode: true` with the script, tone, variety, a female
                  voice and background music, with a completion callback.
                summary: Advanced mode
                value:
                  model: ai-music-api/speech
                  callBackUrl: https://your-domain.com/api/callback
                  input:
                    customMode: true
                    script: >-
                      Welcome to today's briefing. The weather is clear and the
                      city is awake.
                    tone: Warm, calm female narrator, slightly smiling
                    variety: 1
                    vocalGender: f
                    backgroundMusic: true
              'Advanced mode: script only':
                description: >-
                  Only the required `script`, with `\n` line breaks; the model
                  decides the rest.
                summary: 'Advanced mode: script only'
                value:
                  model: ai-music-api/speech
                  input:
                    customMode: true
                    script: |-
                      Attention, please.
                      The train to the coast is now arriving.
            schema:
              $ref: '#/components/schemas/SunoCreateTaskRequestSunoSpeechInput'
        required: true
      responses:
        '200':
          content:
            application/json:
              examples:
                Created:
                  description: '`data.taskId` is the task ID.'
                  summary: Created
                  value:
                    code: 200
                    msg: success
                    data:
                      taskId: 7d3f0a9c41e85b2f6a1c9e04b8d27f53
                Invalid request (422):
                  description: The request is invalid; no task is created or charged.
                  summary: Invalid request (422)
                  value:
                    code: 422
                    msg: >-
                      input.variety is only supported when input.customMode is
                      true.
                    data: null
                Unauthorized (401):
                  description: Missing or invalid API Key.
                  summary: Unauthorized (401)
                  value:
                    code: 401
                    msg: >-
                      Unauthorized - Authentication credentials are missing or
                      invalid
                    data: null
                Insufficient balance (402):
                  description: The balance does not cover the task.
                  summary: Insufficient balance (402)
                  value:
                    code: 402
                    msg: >-
                      Insufficient Credits - Account does not have enough
                      credits to perform the operation
                    data: null
                Rate limited (429):
                  description: Rate limit exceeded; retry later.
                  summary: Rate limited (429)
                  value:
                    code: 429
                    msg: >-
                      Rate Limited - Request limit has been exceeded for this
                      resource
                    data: null
                Server error (500):
                  description: >-
                    The service is temporarily unavailable; retry later. Not
                    charged.
                  summary: Server error (500)
                  value:
                    code: 500
                    msg: >-
                      Server Error - An unexpected error occurred while
                      processing the request
                    data: null
              schema:
                $ref: '#/components/schemas/SunoCreateTaskResponse'
          description: >-
            Always HTTP 200. With `code` `200` the task was created and
            `data.taskId` is its ID; any other `code` is an error with the
            reason in `msg` and `data` `null`.
          headers:
            X-Request-Id:
              description: ID of this request; include it when reporting issues.
              schema:
                type: string
components:
  schemas:
    SunoCreateTaskRequestSunoSpeechInput:
      additionalProperties: false
      description: Request body of createTask.
      properties:
        model:
          default: ai-music-api/speech
          description: |-
            Endpoint name; it decides the fields of `input`.

            **Allowed values:**
            - `ai-music-api/speech`: Suno Generate speech
          enum:
            - ai-music-api/speech
          type: string
        callBackUrl:
          description: >-
            Optional URL that receives a callback when the task finishes
            (success or failure); it must be a public `http` / `https` URL.
            Recommended in production; you can also just poll the query
            endpoint. See Task callback for the body and signature.
          type: string
        input:
          $ref: '#/components/schemas/SunoSpeechInput'
          description: Task parameters; the fields depend on `model`.
      required:
        - model
        - input
      type: object
    SunoCreateTaskResponse:
      additionalProperties: false
      description: Response of createTask; always HTTP 200.
      properties:
        code:
          description: >-
            Result code:

            - `200`: success

            - `401`: missing or invalid API Key

            - `402`: insufficient balance

            - `404`: the model does not exist or is not enabled

            - `405`: wrong HTTP method

            - `422`: invalid request, with the reason in `msg`; no task is
            created or charged

            - `429`: too many requests; retry later

            - `455`: service under maintenance

            - `500`: server error; retry later

            - `501`: generation failed

            - `505`: feature disabled
          format: int64
          type: integer
        msg:
          description: 'Message: `success`, or the English reason of an error.'
          type: string
        data:
          $ref: '#/components/schemas/SunoCreateTaskData'
          description: The task on success; `null` on error.
      required:
        - code
        - msg
        - data
      type: object
    SunoSpeechInput:
      additionalProperties: false
      description: >-
        Parameters of `ai-music-api/speech`. `customMode` is required; simple
        mode sends only `prompt`, advanced mode sends `script` plus optional
        fields, and the two modes' fields are mutually exclusive.
      properties:
        customMode:
          description: >-
            Required mode switch. `false`: simple mode, send only `prompt`;
            `true`: advanced mode, send `script` and optionally `tone`,
            `variety`, `vocalGender` and `backgroundMusic`.
          type: boolean
        prompt:
          description: >-
            Scene description, simple mode only and required there: one line
            describing the scene; the model writes the script. 1–3,000
            characters after trimming whitespace. Not allowed in advanced mode.
          maxLength: 3000
          minLength: 1
          type: string
        script:
          description: >-
            The text to be spoken, advanced mode only and required there.
            1–5,000 characters after trimming whitespace; multiline is supported
            (use `\n` for line breaks in JSON).
          maxLength: 5000
          minLength: 1
          type: string
        tone:
          description: >-
            Optional, advanced mode only. Describes the tone, rhythm, emotion
            and setting; you can also describe the accent and accompaniment
            style. Up to 1,000 characters after trimming whitespace.
          maxLength: 1000
          type: string
        variety:
          description: >-
            Optional, advanced mode only, an integer from `0` to `4`: `0` exact
            style, `1` balanced variety, `2` distinct styles, `3` bold
            exploration, `4` unreasonably varied.
          format: double
          maximum: 4
          minimum: 0
          multipleOf: 1
          type: number
        vocalGender:
          description: >-
            Optional, advanced mode only, vocal gender: `f` female, `m` male,
            case-insensitive. Do not send `female` / `male`.


            **Allowed values:**

            - `m`: Male voice

            - `f`: Female voice
          enum:
            - m
            - f
          type: string
        backgroundMusic:
          description: >-
            Optional, advanced mode only: whether to add background music,
            `true` on, `false` off.
          type: boolean
      required:
        - customMode
      type: object
    SunoCreateTaskData:
      additionalProperties: false
      description: The created task.
      properties:
        taskId:
          description: >-
            Task ID (32 hex digits), used to query the task and as the `task_id`
            of follow-up endpoints.
          type: string
      required:
        - taskId
      type: object
  securitySchemes:
    bearerAuth:
      description: >-
        API Key created in the DreamTo console, sent as `Authorization: Bearer
        <API Key>`.
      scheme: bearer
      type: http

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.