AI SaaS API For Developers
Integrasikan kemampuan AI kami ke dalam aplikasi Anda sendiri dengan sederhana.
Authentication
Setiap request ke API harus menyertakan API Key Anda di header.
X-Api-Key: prod-sk-16randomhex...
Jika Anda belum memiliki API Key, silakan login melalui User Dashboard untuk mendapatkannya.
Generate Text Endpoint
Menghasilkan teks AI berdasarkan prompt yang diberikan.
POST
/api/v1/chat/generate
Request Headers
| Header | Type | Required | Description |
|---|---|---|---|
| Content-Type | string | Yes | application/x-www-form-urlencoded |
| X-Api-Key | string | Yes | Your account API Key |
Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| prompt | string | Yes | Instruksi teks yang ingin diproses AI. |
Example Request (cURL)
curl -X POST "https://ao.baktimakmur.com/api/v1/chat/generate" \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "X-Api-Key: prod-sk-123..." \
-d "prompt=Tuliskan slogan untuk kedai kopi"
Example Request (Python)
import requests
url = "https://ao.baktimakmur.com/api/v1/chat/generate"
headers = {
"X-Api-Key": "prod-sk-123...",
"Content-Type": "application/x-www-form-urlencoded"
}
data = {"prompt": "Buatkan deskripsi produk sepatu"}
response = requests.post(url, headers=headers, data=data)
print(response.json())
Response Body (Success 200)
{
"text": "Kedai kopi terbaik di kota, rasa yang tak terlupakan.",
"quota_remaining": 99,
"model_used": "gpt-3.5-turbo"
}
Error Responses
| Code | Description |
|---|---|
| 403 | Invalid API Key |
| 429 | Quota Habis (Quota Exceeded) |
| 400 | Missing prompt parameter |
Butuh bantuan integrasi? Hubungi technical support kami.