This is a paid text test using the administrator’s own valid Key and wallet. Confirm channel, credential and price versions, confirmed and maximum_charge_micro before sending. Keep Idempotency-Key; recover unknown execution by the original request ID instead of regenerating.
Authentication
Administrator. Session/administrative writes are not executed in the public Playground.
Endpoint
curl --request POST 'https://api.oneaster.ai/core/v1/admin/channels/1/test' \ --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": {
"key_id": {
"type": "string",
"pattern": "^[1-9][0-9]*$"
},
"expected_version": {
"type": "integer",
"minimum": 1,
"maximum": 2147483646
},
"credential_version": {
"type": "integer",
"minimum": 1,
"maximum": 2147483646
},
"price_version": {
"type": "integer",
"minimum": 1,
"maximum": 2147483646
},
"maximum_charge_micro": {
"type": "string",
"pattern": "^(0|[1-9][0-9]*)$",
"description": "确认金额0–1000000(最多100积分),约束整笔预留及实际扣费;不得缩小原计量策略。",
"maxLength": 7
},
"confirmed": {
"const": true
},
"reference": {
"type": "string",
"minLength": 1,
"maxLength": 300
},
"chat": {
"type": "object",
"additionalProperties": false,
"properties": {
"model": {
"type": "string"
},
"messages": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"properties": {
"role": {
"enum": [
"system",
"user",
"assistant"
]
},
"content": {
"type": "string"
}
},
"required": [
"role",
"content"
]
},
"minItems": 1,
"maxItems": 16,
"description": "所有content合计最多4096字节。"
},
"max_tokens": {
"type": "integer",
"minimum": 1,
"maximum": 256
},
"stream": {
"type": "boolean"
},
"temperature": {
"type": "number",
"minimum": 0,
"maximum": 2
}
},
"required": [
"model",
"messages",
"max_tokens"
]
}
},
"required": [
"key_id",
"expected_version",
"credential_version",
"price_version",
"maximum_charge_micro",
"confirmed",
"reference",
"chat"
]
}
Responses
200
确认预算后,使用本人Key对指定启用渠道执行一次收费文本测试
{
"application/json": {
"schema": {}
},
"text/event-stream": {
"schema": {
"type": "string",
"description": "data JSON 与 keepalive 注释,等待上游响应头期间也发送心跳。心跳提交 HTTP 200 后失败仍返回 SSE data error;开始流之前的错误返回 JSON。最终累计 usage 必须完整,部分最终帧不结算。PG 结算成功后发 [DONE];异常不发成功终止标记。缓存分类缺失为未知,不改变输入/输出售价。"
}
}
}
429
账户滚动 60 秒 300 RPM 限制;本次未新增预留或上游发送。
{
"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"
]
}
}
}
503
容量或后端不可用。若含 request ID 仍须查状态。
{
"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"
]
}
}
}
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"
]
}
}
}