🤖 AI Chat API Documentation

Open Chat →

Base URL

http://localhost:8080

🔐 Authentication

Most endpoints require authentication. Include your JWT token in the header:

Authorization: Bearer YOUR_JWT_TOKEN
POST/auth/send-otp

Send OTP to phone number. The OTP is stored in Redis for 5 minutes.

Request Body

{
  "phone": "+6281234567890"
}

Response

{
  "message": "OTP sent",
  "otp": "123456"  // Only in dev mode!
}

cURL Example

curl -X POST "http://localhost:8080/auth/send-otp" \
  -H "Content-Type: application/json" \
  -d '{  "phone": "+6281234567890"}'
POST/auth/verify-otp

Verify OTP and receive JWT token. Use this token for all authenticated requests.

Request Body

{
  "phone": "+6281234567890",
  "otp": "123456"
}

Response

{
  "token": "eyJhbGciOiJIUzI1NiIs...",
  "user": {
    "id": "uuid-here",
    "phone": "+6281234567890"
  }
}

cURL Example

curl -X POST "http://localhost:8080/auth/verify-otp" \
  -H "Content-Type: application/json" \
  -d '{  "phone": "+6281234567890",  "otp": "123456"}'
GET/auth/me🔒 Auth Required

Get current authenticated user info.

Response

{
  "id": "uuid-here",
  "phone": "+6281234567890"
}

cURL Example

curl -X GET "http://localhost:8080/auth/me" \
  -H "Authorization: Bearer YOUR_TOKEN"

💡 Tips

  • • Use stream: true for real-time responses
  • • The /v1/chat/completions endpoint is stateless (no history)
  • • Use conversations for chat with memory
  • • Token expires in 7 days
  • • Audio supports: WebM, MP3, WAV, OGG, M4A