Administrator

POST /core/v1/admin/task-models/{id}/revisions

Administrator · POST /core/v1/admin/task-models/{id}/revisions

Authentication

Administrator. Session/administrative writes are not executed in the public Playground.

Endpoint

curl --request POST 'https://api.oneaster.ai/core/v1/admin/task-models/1/revisions' \
  --header 'Authorization: Bearer '"$ONEASTER_SESSION_TOKEN" \
  --header 'Idempotency-Key: '"$ONEASTER_INTENT" \
  --header 'Content-Type: application/json' \
  --data "$REQUEST_BODY_JSON"

Parameters

- id (path, Required): {"type":"string","pattern":"^[0-9]+$"}

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

Request JSON Schema

{
  "oneOf": [
    {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "expected_version": {
          "type": "integer",
          "minimum": 1,
          "maximum": 2147483646
        },
        "provider_id": {
          "type": "string",
          "pattern": "^[0-9]+$"
        },
        "unit_price_micro": {
          "type": "string",
          "pattern": "^[0-9]+$",
          "description": "整数账务单位;1 积分 = 10000 单位,1 USD = 100 积分。前端用 BigInt。"
        },
        "enabled": {
          "type": "boolean"
        },
        "reference": {
          "type": "string",
          "minLength": 1,
          "maxLength": 300
        },
        "kind": {
          "const": "image",
          "default": "image"
        },
        "upstream_model": {
          "enum": [
            "z-image",
            "image-01"
          ],
          "description": "Immutable upstream. image-01 requires a minimax-image channel. Omission keeps legacy z-image on create or preserves the upstream on revision."
        }
      },
      "required": [
        "expected_version",
        "provider_id",
        "unit_price_micro",
        "enabled",
        "reference"
      ]
    },
    {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "kind": {
          "const": "video"
        },
        "upstream_model": {
          "enum": [
            "bytedance/v1-lite-text-to-video",
            "runway",
            "bytedance/seedance-2-5"
          ],
          "description": "Immutable upstream identity. Create omission keeps legacy Seedance; revision omission preserves the existing upstream."
        },
        "provider_id": {
          "type": "string",
          "pattern": "^[0-9]+$"
        },
        "video_prices": {
          "type": "object",
          "minProperties": 1,
          "maxProperties": 3,
          "additionalProperties": false,
          "properties": {
            "480p": {
              "type": "string",
              "pattern": "^[1-9][0-9]{0,14}$",
              "description": "Explicit gateway integer units per second, at most 100000000000000; unconfigured resolutions cannot be submitted."
            },
            "720p": {
              "type": "string",
              "pattern": "^[1-9][0-9]{0,14}$",
              "description": "Explicit gateway integer units per second, at most 100000000000000; unconfigured resolutions cannot be submitted."
            },
            "1080p": {
              "type": "string",
              "pattern": "^[1-9][0-9]{0,14}$",
              "description": "Explicit gateway integer units per second, at most 100000000000000; unconfigured resolutions cannot be submitted."
            }
          }
        },
        "enabled": {
          "type": "boolean"
        },
        "reference": {
          "type": "string",
          "minLength": 1,
          "maxLength": 300
        },
        "expected_version": {
          "type": "integer",
          "minimum": 1,
          "maximum": 2147483646
        }
      },
      "required": [
        "kind",
        "provider_id",
        "video_prices",
        "enabled",
        "reference",
        "expected_version"
      ]
    }
  ]
}

Responses

200

同一幂等操作的原结果;不重新激活旧配置

{
  "application/json": {
    "schema": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "success": {
          "const": true
        },
        "data": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "id": {
              "type": "string",
              "pattern": "^[0-9]+$"
            },
            "version": {
              "type": "integer",
              "minimum": 0
            },
            "reused": {
              "type": "boolean"
            }
          },
          "required": [
            "id",
            "version",
            "reused"
          ]
        }
      },
      "required": [
        "success",
        "data"
      ]
    }
  }
}

201

CAS 修订任务售价与渠道,保留原任务快照

{
  "application/json": {
    "schema": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "success": {
          "const": true
        },
        "data": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "id": {
              "type": "string",
              "pattern": "^[0-9]+$"
            },
            "version": {
              "type": "integer",
              "minimum": 0
            },
            "reused": {
              "type": "boolean"
            }
          },
          "required": [
            "id",
            "version",
            "reused"
          ]
        }
      },
      "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"
      ]
    }
  }
}