API Key 接口

POST /v1/tasks

幂等创建单张图片或单个视频任务与报价预留

身份要求

API Key 接口. 会话/管理写操作不在公共 Playground 执行。 model 必须来自当前目录;替换示例占位符后调用。

接口

curl --request POST 'https://api.oneaster.ai/v1/tasks' \
  --header 'Authorization: Bearer '"$ONEASTER_API_KEY" \
  --header 'Idempotency-Key: '"$ONEASTER_INTENT" \
  --header 'Content-Type: application/json' \
  --data '{
  "kind": "image",
  "model": "YOUR_IMAGE_MODEL_ID",
  "input": {
    "prompt": "A white ceramic mug on an oak table",
    "aspect_ratio": "1:1"
  }
}'

参数

- Idempotency-Key (header, 必填): {"type":"string","minLength":1,"maxLength":100}

请求 JSON Schema

{
  "oneOf": [
    {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "kind": {
          "const": "image"
        },
        "model": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200
        },
        "input": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "prompt": {
              "type": "string",
              "minLength": 1,
              "maxLength": 1000
            },
            "aspect_ratio": {
              "enum": [
                "1:1",
                "4:3",
                "3:4",
                "16:9",
                "9:16"
              ]
            }
          },
          "required": [
            "prompt",
            "aspect_ratio"
          ]
        }
      },
      "required": [
        "kind",
        "model",
        "input"
      ]
    },
    {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "kind": {
          "const": "video"
        },
        "model": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200
        },
        "input": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "prompt": {
              "type": "string",
              "minLength": 1,
              "maxLength": 20480
            },
            "aspect_ratio": {
              "enum": [
                "16:9",
                "4:3",
                "1:1",
                "3:4",
                "9:16",
                "9:21",
                "21:9"
              ]
            },
            "resolution": {
              "enum": [
                "480p",
                "720p",
                "1080p"
              ]
            },
            "duration": {
              "type": "integer",
              "enum": [
                5,
                10
              ]
            },
            "camera_fixed": {
              "type": "boolean"
            }
          },
          "required": [
            "prompt",
            "aspect_ratio",
            "resolution",
            "duration"
          ]
        }
      },
      "required": [
        "kind",
        "model",
        "input"
      ],
      "description": "Input is validated against the selected public model upstream. Seedance Lite: prompt<=10000, all listed resolutions at 5/10s, 9:21 supported, camera_fixed supported. Seedance 2.5: prompt<=20480, all listed resolutions at 5/10s, 21:9 supported instead of 9:21; camera_fixed must be omitted, audio/draft/search/last-frame disabled, MP4 output and safety checker enabled. Runway: prompt<=1800, 720p at 5/10s or 1080p at 5s, camera_fixed must be omitted. Read task-model capabilities for valid combinations; no arbitrary passthrough or reference inputs for Seedance 2.5."
    },
    {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "kind": {
          "const": "video"
        },
        "model": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200
        },
        "input": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "prompt": {
              "type": "string",
              "minLength": 1,
              "maxLength": 1800
            },
            "image_task_id": {
              "type": "string",
              "format": "uuid"
            },
            "resolution": {
              "enum": [
                "720p",
                "1080p"
              ]
            },
            "duration": {
              "type": "integer",
              "enum": [
                5,
                10
              ]
            }
          },
          "required": [
            "prompt",
            "image_task_id",
            "resolution",
            "duration"
          ]
        }
      },
      "required": [
        "kind",
        "model",
        "input"
      ],
      "description": "Runway only: same-user, same-Key settled Core PNG, <=10 MiB. Omit aspect_ratio and camera_fixed; ratio follows source image. 1080p only supports 5 seconds. No arbitrary image_url or Node asset paths."
    }
  ]
}

响应

202

幂等创建单张图片或单个视频任务与报价预留

{
  "application/json": {
    "schema": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "success": {
          "const": true
        },
        "data": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "id": {
              "type": "string",
              "format": "uuid"
            },
            "reused": {
              "type": "boolean"
            },
            "status_url": {
              "type": "string"
            }
          },
          "required": [
            "id",
            "reused",
            "status_url"
          ]
        }
      },
      "required": [
        "success",
        "data"
      ]
    }
  }
}

default

错误代码见 core-api.md;供应商/数据库错误已隐藏。

{
  "application/json": {
    "schema": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "success": {
          "const": false
        },
        "error": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "code": {
              "type": "string"
            },
            "message": {
              "type": "string"
            },
            "type": {
              "const": "oneaster_error"
            }
          },
          "required": [
            "code",
            "message",
            "type"
          ]
        },
        "data": {
          "type": "null"
        }
      },
      "required": [
        "success",
        "error",
        "data"
      ]
    }
  }
}