Chat API

Send a message and receive an assistant response. Automatically creates a session, or continues an existing one when you pass a session_id.

POST/v1/chat

Authentication

Requires a secret API key passed as a Bearer token (Authorization: Bearer carrier_sk_…).

Request body

FieldTypeDescription
mode*stringCarrier mode: general, developer, or research.
message*stringThe user message to send.
session_idstringContinue an existing session. Omit to start a new one.

Example request

bash
curl -X POST https://api.carrieros.ai/v1/chat \
  -H "Authorization: Bearer carrier_sk_live_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "mode": "developer",
    "message": "Explain OAuth in two sentences."
  }'

Response

FieldTypeDescription
idstringIdentifier of the generated assistant message.
responsestringThe assistant's reply.
session_idstringSession id — reuse it to continue the conversation.
tokens_usednumberTotal input + output tokens for this turn.

Example response

json
{
  "success": true,
  "data": {
    "id": "b1e2…",
    "response": "OAuth is an open standard for delegated authorization…",
    "session_id": "9c4f…",
    "tokens_used": 523
  }
}

Possible errors

CodeHTTPWhen it occurs
VALIDATION_ERROR400mode is missing/invalid, or message is empty.
SESSION_NOT_FOUND404A session_id was passed that doesn't belong to this project.
USAGE_LIMIT_REACHED402The account's usage/credit limit has been reached.
INVALID_API_KEY401The key is missing, malformed, revoked, or inactive.

Notes

Modes map to internal configurations — provider models are never exposed. See Carrier Modes.

The response is non-streaming. To keep context across turns, pass the returned session_id on subsequent requests.