API Key

POST /v1/messages

API Key · POST /v1/messages

支持 OpenAI Chat/Responses、KIE GPT 和 Anthropic 原生或兼容转换。previous_response_id 只接受 Core 本地本人Key历史;store默认true,GET/DELETE管理响应。付费托管工具、供应商文件ID和后台执行关闭;不支持字段发送前拒绝。最终用量不确定时保留预留。

Authentication

API Key. Session/administrative writes are not executed in the public Playground. model must be a current public name. Text placeholders prepare a body for review; replace image/video placeholders according to current specifications.

Endpoint

curl --request POST 'https://api.oneaster.ai/v1/messages' \
  --header 'Authorization: Bearer '"$ONEASTER_API_KEY" \
  --header 'Idempotency-Key: '"$ONEASTER_INTENT" \
  --header 'Content-Type: application/json' \
  --data '{
  "model": "YOUR_TEXT_MODEL_NAME",
  "messages": [
    {
      "role": "user",
      "content": "Hello"
    }
  ],
  "max_tokens": 64,
  "stream": false
}'

Parameters

- Idempotency-Key (header, Optional): {"type":"string","minLength":1,"maxLength":100} 可选;提供后 JSON 成功请求可以按原请求重放。

Request JSON Schema

application/json

{
  "schema": {
    "type": "object",
    "additionalProperties": true,
    "required": [
      "model",
      "messages"
    ],
    "properties": {
      "model": {
        "type": "string"
      },
      "messages": {
        "type": "array",
        "items": {
          "type": "object",
          "additionalProperties": true
        }
      },
      "system": {},
      "tools": {
        "type": "array",
        "items": {
          "type": "object",
          "additionalProperties": true
        }
      },
      "tool_choice": {},
      "thinking": {
        "type": "object",
        "additionalProperties": true
      },
      "output_config": {
        "type": "object",
        "additionalProperties": true
      },
      "stop_sequences": {
        "type": "array",
        "items": {
          "type": "string"
        }
      },
      "top_k": {
        "type": "integer",
        "minimum": 0
      },
      "max_tokens": {
        "type": "integer",
        "minimum": 1,
        "maximum": 65536
      },
      "stream": {
        "type": "boolean"
      }
    }
  }
}

Responses

200

Messages:原生与跨协议 JSON/SSE;工具、图片、推理,托管工具关闭

{
  "content": {
    "application/json": {
      "schema": {}
    },
    "text/event-stream": {
      "schema": {
        "type": "string",
        "description": "与客户端接口一致的具名SSE;最终用量验证并结算后发送结束事件,失败保留预留。"
      }
    }
  },
  "headers": {}
}

503

错误代码见 core-api.md;供应商/数据库错误已隐藏。

{
  "content": {
    "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"
        ]
      }
    }
  },
  "headers": {}
}

default

错误代码见 core-api.md;供应商/数据库错误已隐藏。

{
  "content": {
    "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"
        ]
      }
    }
  },
  "headers": {}
}