使用原生登录 access_token 直接扣减本人钱包调用 Responses JSON/SSE。支持稳定 Idempotency-Key 持久化意图与断线恢复。
POST
/pg/responsesAuthorizations
AuthorizationstringrequiredUse a native login access_token (required access: Native access token) with owner isolation and trusted browser Origin; generation writes use wallet billing while reads do not precharge; inference API Keys (sk-…) and PATs (nap_…) are rejected.
Authorization: Bearer $ONEASTER_ACCESS_TOKEN
Parameters
Idempotency-Keystringheader · 每次新发起的 /pg 生成提交建议由前端生成并持久化稳定的 1–100 位无空格可打印 ASCII 标识(推荐 UUID),断线重试保持原标识与原请求字节。同账号跨所有 /pg POST 协议共用一个命名空间;省略时后端兼容生成并通过 X-OneAster-Intent-ID 返回,但若响应头丢失将无法按意图恢复。
Body · application/json
modelstringrequiredinputoneOf输入内容,可以是字符串或消息数组
instructionsstringmax_output_tokensintegertemperaturenumbertop_pnumberstreambooleantoolsarraytool_choiceoneOfreasoningobjectprevious_response_idstringtruncationstringJSON Schema
{
"type": "object",
"required": [
"model"
],
"properties": {
"model": {
"type": "string"
},
"input": {
"description": "输入内容,可以是字符串或消息数组",
"oneOf": [
{
"type": "string"
},
{
"type": "array",
"items": {
"type": "object",
"properties": {}
}
}
]
},
"instructions": {
"type": "string"
},
"max_output_tokens": {
"type": "integer"
},
"temperature": {
"type": "number"
},
"top_p": {
"type": "number"
},
"stream": {
"type": "boolean"
},
"tools": {
"type": "array",
"items": {
"type": "object",
"properties": {}
}
},
"tool_choice": {
"oneOf": [
{
"type": "string"
},
{
"type": "object",
"properties": {}
}
]
},
"reasoning": {
"type": "object",
"properties": {
"effort": {
"type": "string",
"enum": [
"low",
"medium",
"high"
]
},
"summary": {
"type": "string"
}
}
},
"previous_response_id": {
"type": "string"
},
"truncation": {
"type": "string",
"enum": [
"auto",
"disabled"
]
}
}
}