Dokumentasi API
Mulai cepat
Base URL
https://api.heraxles.dev/v1
Autentikasi
Authorization: Bearer YOUR_API_KEYFormat
application/jsonAutentikasi
Authorization: Bearer hx_xxxxxxxxxxxxxxxxxxxx
x-api-key: hx_xxxxxxxxxxxxxxxxxxxx # alternatif
Daftar model
curl https://api.heraxles.dev/v1/models \ -H "Authorization: Bearer YOUR_API_KEY"
Chat completions
POST /v1/chat/completions
| Parameter | Tipe | Keterangan |
|---|---|---|
model | string | |
messages | array | |
stream | boolean | |
max_tokens | integer | |
temperature | number | |
tools | array |
Contoh permintaan
curl https://api.heraxles.dev/v1/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "claude-opus-5",
"messages": [
{"role": "system", "content": "Jawab singkat dalam Bahasa Indonesia."},
{"role": "user", "content": "Jelaskan apa itu API dalam 2 kalimat."}
],
"max_tokens": 300,
"stream": true
}'
Bentuk jawaban
{
"id": "chatcmpl-...",
"object": "chat.completion",
"model": "claude-opus-5",
"choices": [{
"index": 0,
"message": {"role": "assistant", "content": "..."},
"finish_reason": "stop"
}],
"usage": {"prompt_tokens": 42, "completion_tokens": 128, "total_tokens": 170}
}
Streaming
data: {"choices":[{"delta":{"content":"Se"}}]}
data: {"choices":[{"delta":{"content":"buah"}}]}
data: {"choices":[{"delta":{},"finish_reason":"stop"}],
"usage":{"total_tokens":170}}
data: [DONE]
Function calling
{
"model": "claude-opus-5",
"messages": [{"role": "user", "content": "Cuaca Jakarta?"}],
"tools": [{
"type": "function",
"function": {
"name": "get_weather",
"description": "Ambil cuaca sebuah kota",
"parameters": {
"type": "object",
"properties": {"city": {"type": "string"}},
"required": ["city"]
}
}
}]
}
/v1/responses
curl https://api.heraxles.dev/v1/responses \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"claude-opus-5","input":"Halo","stream":true}'
Setelan per alat
Cek kuota & masa aktif
Batas & header
| Header | Arti |
|---|---|
X-RateLimit-Limit |
|
X-RateLimit-Remaining |
|
X-RateLimit-Reset |
|
Retry-After |
Kode error
| HTTP | code | Penyebab & tindakan |
|---|---|---|
| 401 | invalid_api_key |
|
| 403 | phone_unverified |
|
| 403 | model_not_allowed |
|
| 402 | free_quota_exhausted |
|
| 402 | insufficient_quota |
|
| 429 | rate_limited |
|
| 429 | parallel_limit |
|
| 503 | chat_capacity |