Chat Completions
POST /chat/completions — the primary endpoint. Compatible with the OpenAI Chat Completions API.
Request
json
{
"model": "varunsh/atlas-mini",
"messages": [
{ "role": "system", "content": "You are concise." },
{ "role": "user", "content": "What is an API gateway?" }
],
"temperature": 0.7,
"max_tokens": 512,
"stream": false
}Parameters
model— required. A model id from/models.messages— required. Array of role/content messages.stream— optional. Whentrue, responds with SSE.temperature,top_p— optional sampling controls.max_tokens— optional output cap.tools,tool_choice— optional tool calling (model-dependent).
Response
json
{
"id": "chatcmpl_...",
"object": "chat.completion",
"created": 1700000000,
"model": "varunsh/atlas-mini",
"choices": [
{
"index": 0,
"message": { "role": "assistant", "content": "..." },
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 18,
"completion_tokens": 122,
"total_tokens": 140
}
}Streaming
With "stream": true, the response is text/event-stream. Each event is a chat.completion.chunk; the final chunk carries usage, followed by data: [DONE].
bash
curl -N https://api-gw.aimasteryedu.in/v1/chat/completions \
-H "Authorization: Bearer $VARUNSH_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "model": "varunsh/atlas-mini", "messages": [{"role":"user","content":"Hi"}], "stream": true }'