AI API for Developers
AI API for Developers
The Kinexa AI API allows developers to integrate AI capabilities into their applications using the Kinexa AI Gateway.
Authentication
All AI API requests require a Bearer token (JWT) obtained from Kinexa SSO:
Authorization: Bearer YOUR_JWT_TOKENJWT tokens are obtained by authenticating through the Kinexa SSO system. See the API Getting Started guide for details.
POST /api/ai/chat
Send a message to the AI and receive a response.
Request:
{
"messages": [
{ "role": "system", "content": "You are a helpful assistant." },
{ "role": "user", "content": "What are your business hours?" }
],
"model": "auto",
"temperature": 0.7,
"max_tokens": 1024
}modelβ Use"auto": the gateway picks the engine for your plan (Liqaa AI, Liqaa AI Plus or Liqaa AI Pro)temperatureβ Creativity level (0.0 = deterministic, 1.0 = creative)max_tokensβ Maximum response length
Response:
{
"success": true,
"data": {
"id": "msg_abc123",
"content": "Our business hours are Monday to Friday, 9 AM to 5 PM WIB.",
"model": "liqaa-ai",
"usage": {
"prompt_tokens": 24,
"completion_tokens": 18,
"total_tokens": 42
}
}
}GET /api/ai/models
Show the AI level available on your plan.
Response:
{
"success": true,
"data": [
{ "id": "liqaa-ai", "available": true },
{ "id": "liqaa-ai-plus", "available": false, "reason": "Requires Pro tier" }
]
}GET /api/ai/health
Check the health of the AI gateway.
Response:
{
"success": true,
"data": {
"gateway": { "status": "healthy", "latency_ms": 180 }
}
}Example: JavaScript/TypeScript
const response = await fetch("https://api.kinexa.id/v1/ai/chat", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": `Bearer ${token}`,
},
body: JSON.stringify({
messages: [
{ role: "user", content: "Summarize our sales this month" }
],
model: "auto",
}),
});
const data = await response.json();
logger.info(data.data.content);Rate Limiting per Tier
| Tier | AI Requests/Minute | AI Requests/Day |
|---|---|---|
| Free | 10 | 100 |
| Starter | 30 | 500 |
| Pro | 100 | 5,000 |
| Business | 300 | 20,000 |
| Enterprise | Custom | Custom |
When you exceed the limit, you receive a 429 Too Many Requests response with a Retry-After header.
Error Codes
| Code | Meaning |
|---|---|
| 400 | Invalid request body or parameters |
| 401 | Missing or invalid JWT token |
| 403 | Model not available for your tier |
| 429 | Rate limit exceeded |
| 503 | AI provider temporarily unavailable |