Authentication
Account session. Session/administrative writes are not executed in the public Playground.
Endpoint
curl --request POST 'https://api.oneaster.ai/core/v1/keys/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
{
"type": "object",
"additionalProperties": false,
"properties": {
"expected_version": {
"type": "integer",
"minimum": 1,
"maximum": 2147483646
},
"name": {
"type": "string",
"minLength": 1,
"maxLength": 80
},
"budget_micro": {
"anyOf": [
{
"type": "string",
"pattern": "^(?:[0-9]+|\\s*)$",
"description": "选填;省略、null 或空白不设置 Key 独立额度。填写正整数时不得超过钱包当前 balance_micro;额度单位为整数 micro。"
},
{
"type": "null"
}
]
},
"models": {
"type": "array",
"items": {
"type": "string",
"minLength": 1,
"maxLength": 200
},
"maxItems": 50,
"uniqueItems": true,
"description": "修订必须显式传数组;[] 表示所有当前及未来模型,省略或 null 无效。"
},
"expires_at": {
"type": "string",
"format": "date-time"
},
"reference": {
"type": "string",
"minLength": 1,
"maxLength": 300
}
},
"required": [
"expected_version",
"name",
"models",
"expires_at",
"reference"
]
}
Responses
200
同一幂等操作的原结果;不重新激活旧配置
{
"application/json": {
"schema": {
"type": "object",
"additionalProperties": false,
"properties": {
"success": {
"const": true
},
"data": {
"type": "object",
"additionalProperties": false,
"properties": {
"version": {
"type": "integer",
"minimum": 1
},
"reused": {
"type": "boolean"
}
},
"required": [
"version",
"reused"
]
}
},
"required": [
"success",
"data"
]
}
}
}
201
修订本人 Key 的名称、预算、模型和到期
{
"application/json": {
"schema": {
"type": "object",
"additionalProperties": false,
"properties": {
"success": {
"const": true
},
"data": {
"type": "object",
"additionalProperties": false,
"properties": {
"version": {
"type": "integer",
"minimum": 1
},
"reused": {
"type": "boolean"
}
},
"required": [
"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"
]
}
}
}