Skip to Content
aicentos
API ReferenceChat API

Native Claude Format

Last updated:

Chat

POST /messages

Authentication

Store your API key in AICENTOS_API_KEY; the shell examples expand it in the Authorization: Bearer header.

The API Key obtained under "Token Management" in the console

Location: header

Request Body

application/json

TypeScript type definition

Use the request body type in TypeScript

Response Body

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": "Introduce yourself in one sentence"      }    ]  }'
{
  "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"
  }
}