Administrator

GET /core/v1/admin/task-costs

Administrator · GET /core/v1/admin/task-costs

Authentication

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

Endpoint

curl --request GET 'https://api.oneaster.ai/core/v1/admin/task-costs' \
  --header 'Authorization: Bearer '"$ONEASTER_SESSION_TOKEN"

Parameters

- page (query, Optional): {"type":"integer","minimum":1,"maximum":1000000,"default":1}

- size (query, Optional): {"type":"integer","minimum":1,"maximum":100,"default":20}

- from (query, Optional): {"type":"string","format":"date-time"} 包含from,不包含to;UTC、最多微秒精度,默认最近30天、最长366天。

- to (query, Optional): {"type":"string","format":"date-time"} 包含from,不包含to;UTC、最多微秒精度,默认最近30天、最长366天。

- user_id (query, Optional): {"type":"string","pattern":"^[0-9]+$"}

- key_id (query, Optional): {"type":"string","pattern":"^[0-9]+$"}

- provider_id (query, Optional): {"type":"string","pattern":"^[0-9]+$"}

- model (query, Optional): {"type":"string","minLength":1,"maxLength":200}

- upstream_model (query, Optional): {"type":"string","minLength":1,"maxLength":200}

- kind (query, Optional): {"enum":["image","video"]}

- input_mode (query, Optional): {"enum":["text_to_image","text_to_video","image_to_video"]}

- state (query, Optional): {"enum":["queued","submitting","submitted","running","success","failed","rejected","unknown"]}

- billing_state (query, Optional): {"enum":["reserved","settled","released"]}

- cost_status (query, Optional): {"enum":["reported","unreported","invalid_evidence"]}

- resolution (query, Optional): {"enum":["480p","720p","1080p"]}

- duration (query, Optional): {"enum":[5,10]}

- issue (query, Optional): {"enum":["unresolved","cost_mismatch","nonzero_failure","invalid_evidence","unreported_terminal"]}

Responses

200

任务采购费用与核账异常明细;不返回提示词/产物URL/凭据

{
  "application/json": {
    "schema": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "success": {
          "const": true
        },
        "data": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "from": {
              "type": "string",
              "format": "date-time"
            },
            "to": {
              "type": "string",
              "format": "date-time"
            },
            "sampled_at": {
              "type": "string",
              "format": "date-time"
            },
            "timezone": {
              "const": "UTC"
            },
            "attribution": {
              "const": "request_created_at"
            },
            "scope": {
              "const": "persisted_core_image_video_tasks"
            },
            "health_basis": {
              "const": "validated_terminal_task_evidence"
            },
            "paid_probes": {
              "const": false
            },
            "supplier_cost_unit": {
              "const": "kie_credit"
            },
            "supplier_cost_scope": {
              "const": "kie_tasks_only"
            },
            "currency": {
              "const": "CREDITS"
            },
            "micro_per_credit": {
              "const": 10000
            },
            "items": {
              "type": "array",
              "items": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "provider_id": {
                    "type": "string",
                    "pattern": "^[0-9]+$"
                  },
                  "model": {
                    "type": "string"
                  },
                  "upstream_model": {
                    "type": "string"
                  },
                  "kind": {
                    "enum": [
                      "image",
                      "video"
                    ]
                  },
                  "resolution": {
                    "anyOf": [
                      {
                        "enum": [
                          "480p",
                          "720p",
                          "1080p"
                        ]
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "duration": {
                    "anyOf": [
                      {
                        "enum": [
                          5,
                          10
                        ]
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "input_mode": {
                    "enum": [
                      "text_to_image",
                      "text_to_video",
                      "image_to_video"
                    ]
                  },
                  "id": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "user_id": {
                    "type": "string",
                    "pattern": "^[0-9]+$"
                  },
                  "key_id": {
                    "type": "string",
                    "pattern": "^[0-9]+$"
                  },
                  "state": {
                    "enum": [
                      "queued",
                      "submitting",
                      "submitted",
                      "running",
                      "success",
                      "failed",
                      "rejected",
                      "unknown"
                    ]
                  },
                  "billing_state": {
                    "enum": [
                      "reserved",
                      "settled",
                      "released"
                    ]
                  },
                  "price_version": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "unit_price_micro": {
                    "type": "string",
                    "pattern": "^[0-9]+$",
                    "description": "整数账务单位;1 积分 = 10000 单位,1 USD = 100 积分。前端用 BigInt。"
                  },
                  "quantity": {
                    "enum": [
                      1,
                      5,
                      10
                    ]
                  },
                  "reservation_micro": {
                    "type": "string",
                    "pattern": "^[0-9]+$",
                    "description": "整数账务单位;1 积分 = 10000 单位,1 USD = 100 积分。前端用 BigInt。"
                  },
                  "charge_micro": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^[0-9]+$",
                        "description": "整数账务单位;1 积分 = 10000 单位,1 USD = 100 积分。前端用 BigInt。"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "supplier_cost_unit": {
                    "anyOf": [
                      {
                        "const": "kie_credit"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "expected_supplier_credits": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^[0-9]+([.][0-9]+)?$",
                        "description": "KIE积分十进制字符串;不是美元或网关积分。使用十进制定点库,不用Number。"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "actual_supplier_credits": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^[0-9]+([.][0-9]+)?$",
                        "description": "KIE积分十进制字符串;不是美元或网关积分。使用十进制定点库,不用Number。"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "has_supplier_task_id": {
                    "type": "boolean"
                  },
                  "terminal_state": {
                    "anyOf": [
                      {
                        "enum": [
                          "success",
                          "fail"
                        ]
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "cost_status": {
                    "enum": [
                      "reported",
                      "unreported",
                      "invalid_evidence"
                    ]
                  },
                  "cost_mismatch": {
                    "type": "boolean"
                  },
                  "nonzero_failure": {
                    "type": "boolean"
                  },
                  "unresolved": {
                    "type": "boolean"
                  },
                  "created_at": {
                    "type": "string",
                    "format": "date-time"
                  }
                },
                "required": [
                  "provider_id",
                  "model",
                  "upstream_model",
                  "kind",
                  "resolution",
                  "duration",
                  "input_mode",
                  "id",
                  "user_id",
                  "key_id",
                  "state",
                  "billing_state",
                  "price_version",
                  "unit_price_micro",
                  "quantity",
                  "reservation_micro",
                  "charge_micro",
                  "supplier_cost_unit",
                  "expected_supplier_credits",
                  "actual_supplier_credits",
                  "has_supplier_task_id",
                  "terminal_state",
                  "cost_status",
                  "cost_mismatch",
                  "nonzero_failure",
                  "unresolved",
                  "created_at"
                ]
              }
            },
            "total": {
              "type": "string",
              "pattern": "^[0-9]+$"
            },
            "page": {
              "type": "integer",
              "minimum": 0
            },
            "size": {
              "type": "integer",
              "minimum": 0
            }
          },
          "required": [
            "from",
            "to",
            "sampled_at",
            "timezone",
            "attribution",
            "scope",
            "health_basis",
            "paid_probes",
            "supplier_cost_unit",
            "supplier_cost_scope",
            "currency",
            "micro_per_credit",
            "items",
            "total",
            "page",
            "size"
          ]
        }
      },
      "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"
      ]
    }
  }
}