Skip to Content
aicentos
Tham chiếu APIAPI Chat

Định dạng Claude gốc

Cập nhật lần cuối:

Chat

POST /messages

Xác thực

Lưu API Key vào biến môi trường AICENTOS_API_KEY; các ví dụ shell dùng giá trị của biến trong header Authorization: Bearer.

API Key lấy từ mục "Quản lý token" trong Console

Vị trí: header

Nội dung yêu cầu

application/json

Định nghĩa kiểu TypeScript

Sử dụng kiểu request body trong TypeScript

Nội dung phản hồi

application/json

application/json

application/json

export AICENTOS_API_KEY="sk-your-aicentos-api-key"

curl -X POST "https://aicentos.com/v1/messages" \
  -H "Authorization: Bearer $AICENTOS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{    "model": "claude-sonnet-4-6",    "max_tokens": 256,    "messages": [      {        "role": "user",        "content": "Giới thiệu bản thân trong một câu"      }    ]  }'
{
  "id": "string",
  "type": "message",
  "role": "assistant",
  "content": [
    {
      "type": "text",
      "text": "string"
    }
  ],
  "model": "string",
  "stop_reason": "end_turn",
  "usage": {
    "input_tokens": 0,
    "output_tokens": 0
  }
}
{
  "error": {
    "message": "Incorrect API key provided",
    "type": "authentication_error",
    "code": "invalid_api_key"
  }
}
{
  "error": {
    "message": "Incorrect API key provided",
    "type": "authentication_error",
    "code": "invalid_api_key"
  }
}