Authentication
WebSocket (/v2/chat)
Use query parameters:
apikey=<API-KEY>, ortoken=<ACCESS-TOKEN>
If both are missing, server returns error with code 4002 and closes the socket.
If auth fails, server returns error with code 4001 and closes the socket.
Success event
{
"event": "auth-connect-complete",
"data": {
"ok": true,
"clientId": "uuid",
"timestamp": 1739765563421
}
}
HTTP SSE (/v1/chat/completions)
Use header:
Authorization: Bearer <API-KEY-OR-TOKEN>