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

# 创建任务

> 提交图片、视频或音乐生成。

> 能力按服务端配置逐项启用。未启用操作返回 503 且不创建任务；音乐积分扣除当前未启用。

## 请求

发送 model 和 input 对象；按模型 Schema 将可选 output\_count、fallback 放在 input 内。callback\_url 是可选的顶层公网 HTTPS 地址。不使用 max\_credits、报价步骤或提交幂等键。

每次成功受理都创建新任务。网络超时后重发可能产生另一单和另一笔费用；已配置启用的 Suno 操作创建持久化任务；未启用操作返回 50301 且不创建任务。

```json theme={null}
{
  "model": "prism-image-2",
  "input": {
    "prompt": "A red fox in a snowy forest",
    "output_count": 3,
    "fallback": true
  }
}
```

## 受理响应

已启用模型成功受理后返回 HTTP 200，data 中包含 task\_id；受理不代表生成成功。未启用操作返回 HTTP 503、code 50301，且不创建任务。

```json theme={null}
{
  "code": 200,
  "msg": "success",
  "data": {
    "task_id": "task_example"
  }
}
```


## OpenAPI

````yaml openapi.json POST /api/v1/tasks/create_task
openapi: 3.1.0
info:
  title: APIstable API
  version: 1.0.0-preview
  description: >-
    Public /api/v1 protocol. Valid API keys have the same account-scoped access.
    No client submission idempotency or max_credits. Enabled Suno operations use
    PayAPI and durable task processing. Media uses R2: uploads 24 hours,
    generated files 14 days, task logs 30 days. Music credit deduction is
    disabled. Unconfigured operations and LLM return 503.
servers:
  - url: https://apistable.com
    description: APIstable API
security: []
paths:
  /api/v1/tasks/create_task:
    post:
      summary: Create a media task
      description: >-
        Validates nested model input. Enabled Suno operations create one task;
        disabled operations return 503. Every acceptance creates a new task, so
        resubmission can duplicate supplier work. Music billing is disabled.
        output_count and fallback belong inside input only when supported by the
        model.
      operationId: createTask
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TaskRequest'
      responses:
        '200':
          description: Accepted task. Poll the common task endpoint or use callback_url.
          content:
            application/json:
              schema:
                type: object
                required:
                  - code
                  - msg
                  - data
                additionalProperties: false
                properties:
                  code:
                    const: 200
                  msg:
                    const: success
                  data:
                    type: object
                    required:
                      - task_id
                    additionalProperties: false
                    properties:
                      task_id:
                        type: string
        '400':
          description: >-
            40001 invalid JSON, 40002 invalid input/callback, 40003 unsupported
            parameter.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Invalid or revoked API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '402':
          description: '40201: Insufficient credits (live acceptance).'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: '40401: Unknown model or resource not found in this account.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: '40901: Resource belongs to a different provider account.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '410':
          description: '41001: Source audio or temporary resource has expired.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '413':
          description: '41301: Request too large.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: '42201: Requested music combination is not enabled.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: '42901: Rate/concurrency limit (live acceptance).'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '503':
          description: '50301: Service/provider unavailable. No live submission or charge.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - bearerAuth: []
components:
  schemas:
    TaskRequest:
      allOf:
        - if:
            properties:
              model:
                const: suno_upload
            required:
              - model
          then:
            properties:
              input:
                $ref: '#/components/schemas/suno_upload_input'
        - if:
            properties:
              model:
                const: suno_generate
            required:
              - model
          then:
            properties:
              input:
                $ref: '#/components/schemas/suno_generate_input'
        - if:
            properties:
              model:
                const: suno_extend
            required:
              - model
          then:
            properties:
              input:
                $ref: '#/components/schemas/suno_extend_input'
        - if:
            properties:
              model:
                const: suno_cover
            required:
              - model
          then:
            properties:
              input:
                $ref: '#/components/schemas/suno_cover_input'
        - if:
            properties:
              model:
                const: suno_replace_section
            required:
              - model
          then:
            properties:
              input:
                $ref: '#/components/schemas/suno_replace_section_input'
        - if:
            properties:
              model:
                const: suno_add_instrumental
            required:
              - model
          then:
            properties:
              input:
                $ref: '#/components/schemas/suno_add_instrumental_input'
        - if:
            properties:
              model:
                const: suno_add_vocals
            required:
              - model
          then:
            properties:
              input:
                $ref: '#/components/schemas/suno_add_vocals_input'
        - if:
            properties:
              model:
                const: suno_add_stem
            required:
              - model
          then:
            properties:
              input:
                $ref: '#/components/schemas/suno_add_stem_input'
        - if:
            properties:
              model:
                const: suno_lyrics_timestamps
            required:
              - model
          then:
            properties:
              input:
                $ref: '#/components/schemas/suno_lyrics_timestamps_input'
        - if:
            properties:
              model:
                const: suno_voice_upload
            required:
              - model
          then:
            properties:
              input:
                $ref: '#/components/schemas/suno_voice_upload_input'
        - if:
            properties:
              model:
                const: suno_voice_create
            required:
              - model
          then:
            properties:
              input:
                $ref: '#/components/schemas/suno_voice_create_input'
        - if:
            properties:
              model:
                const: suno_export_wav
            required:
              - model
          then:
            properties:
              input:
                $ref: '#/components/schemas/suno_export_wav_input'
        - if:
            properties:
              model:
                const: suno_export_mp3
            required:
              - model
          then:
            properties:
              input:
                $ref: '#/components/schemas/suno_export_mp3_input'
        - if:
            properties:
              model:
                const: suno_export_midi
            required:
              - model
          then:
            properties:
              input:
                $ref: '#/components/schemas/suno_export_midi_input'
        - if:
            properties:
              model:
                const: suno_separate_vocals
            required:
              - model
          then:
            properties:
              input:
                $ref: '#/components/schemas/suno_separate_vocals_input'
        - if:
            properties:
              model:
                const: suno_persona_prepare
            required:
              - model
          then:
            properties:
              input:
                $ref: '#/components/schemas/suno_persona_prepare_input'
        - if:
            properties:
              model:
                const: suno_persona_create
            required:
              - model
          then:
            properties:
              input:
                $ref: '#/components/schemas/suno_persona_create_input'
      type: object
      required:
        - model
        - input
      additionalProperties: false
      properties:
        model:
          type: string
          example: prism-image-2
        input:
          type: object
          additionalProperties: true
          description: >-
            Validate against the selected model input_schema.
            output_count/fallback are optional model-specific input fields;
            never top-level.
          example:
            prompt: A red fox
            output_count: 3
            fallback: true
        callback_url:
          type: string
          format: uri
          description: >-
            Optional public HTTPS endpoint for signed completion callbacks; no
            redirects or private IPs.
    Error:
      type: object
      required:
        - code
        - msg
        - data
      properties:
        code:
          type: integer
        msg:
          type: string
        data:
          type: 'null'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Every valid key can submit and query its own account. Revoked keys are
        rejected.

````

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