Panduan integrasi Gateway AI Akvira ke aplikasi kamu
https://ai.akvira.my.id/v1/chat/completions
POST
Gunakan header Authorization: Bearer YOUR_TOKEN untuk melakukan request. Endpoint ini kompatibel dengan standar OpenAI SDK.
# Contoh Request Standar
curl -X POST https://ai.akvira.my.id/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer aievo-xxxxxxxx" \
-d '{
"model": "kimi-k2.5",
"messages": [
{"role": "system", "content": "Kamu adalah asisten profesional."},
{"role": "user", "content": "Jelaskan apa itu komputasi kuantum."}
],
"temperature": 0.7,
"stream": false
}'
from openai import OpenAI
client = OpenAI(
base_url="https://ai.akvira.my.id/v1",
api_key="aievo-xxxxxxxx"
)
# Integrasi dengan Streaming
stream = client.chat.completions.create(
model="claude-sonnet-4-6",
messages=[{"role": "user", "content": "Tulis cerita pendek."}],
stream=True,
)
for chunk in stream:
if chunk.choices[0].delta.content is not None:
print(chunk.choices[0].delta.content, end="")
import OpenAI from 'openai';
const client = new OpenAI({
baseURL: 'https://ai.akvira.my.id/v1',
apiKey: 'aievo-xxxxxxxx'
});
async function main() {
try {
const completion = await client.chat.completions.create({
model: "gemini-3.1-pro-preview",
messages: [{ role: "user", content: "Halo!" }],
temperature: 0.5,
max_tokens: 1024
});
console.log(completion.choices[0].message.content);
} catch (error) {
console.error("Error API:", error.status, error.message);
}
}
main();
$apiKey = 'aievo-xxxxxxxx';
$url = 'https://ai.akvira.my.id/v1/chat/completions';
$data = [
'model' => 'kimi-k2.5',
'messages' => [['role' => 'user', 'content' => 'Halo!']],
'temperature' => 0.7
];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer ' . $apiKey,
'Content-Type: application/json'
]);
$response = curl_exec($ch);
curl_close($ch);
?>