Chat Completions
Specifications for executing completions against the Adriaticum inference runtime via the public API.
Canonical Host & Base URL
The public API operates strictly on the dedicated API hostname. Sibling hosts do not serve the machine API.
| Canonical Host | https://api.mijatovic.io |
| Base URL | https://api.mijatovic.io/v1 |
| Endpoint | POST /v1/chat/completions |
| Supported Model | adriaticum |
Authentication
Requests must supply an active API key using standard HTTP Bearer authentication:
Authorization: Bearer $MIJATOVIC_API_KEYAPI keys can be created, renamed, and revoked in Platform → API Keys.
Request Parameters
Requests must be formatted as valid JSON objects. Unrecognized parameters are rejected.
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | Yes | Must be set to adriaticum. |
messages | array | Yes | Array of 1–20 message objects with role (system, user, or assistant) and string content (max 10,000 characters each). |
temperature | number | No | Sampling temperature between 0.0 and 2.0 (default 0.7). |
max_tokens | integer | No | Maximum completion tokens between 1 and 512 (default 248). |
Request Bounds
- Hard request-body limit: 256 KB. Payloads exceeding this limit receive HTTP 413.
- Maximum messages: 20 messages per request.
- Maximum message length: 10,000 characters per message.
- Total content length: 32,000 characters across all messages.
Response Format
Successful completions return HTTP 200 with completion output and truthful usage metrics:
{
"id": "chatcmpl_9a8b7c6d5e4f3a2b1c0d9e8f7a6b5c4d",
"object": "chat.completion",
"created": 1726070000,
"model": "adriaticum",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Hello. How can I assist you today?"
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 12,
"completion_tokens": 9,
"total_tokens": 21
}
}Token metrics (prompt_tokens, completion_tokens, total_tokens) reflect authoritative measurements from the inference runtime. When unavailable, values are returned as null rather than fabricated.
Recorded request metrics can be reviewed in Platform → Usage.
Status Codes & Error Envelope
Errors return a standardized JSON error envelope containing an error code, message, and unique request ID:
{
"error": {
"code": "invalid_api_key",
"message": "The provided API key is invalid or has been revoked.",
"request_id": "chatcmpl_9a8b7c6d5e4f3a2b1c0d9e8f7a6b5c4d"
}
}| Status | Error Code | Description |
|---|---|---|
400 | invalid_request | Malformed JSON, missing required fields, or unsupported parameters. |
401 | invalid_api_key | Missing Authorization header, malformed key, or revoked credential. |
403 | insufficient_permission | API key lacks permission to execute completions. |
404 | not_found | Unknown route or request sent to non-API host. |
413 | payload_too_large | Request body exceeds 256 KB. |
502 | inference_error | Inference service communication error. |
503 | search_unavailable | Factual grounding required Search, but Search was unavailable. |
503 | service_unavailable | Inference service unconfigured or usage persistence failure. |
Code Examples
The following plain HTTP examples demonstrate executing completions. Replace $MIJATOVIC_API_KEY with your developer secret.
cURL
curl -X POST https://api.mijatovic.io/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $MIJATOVIC_API_KEY" \
-d '{
"model": "adriaticum",
"messages": [
{"role": "user", "content": "Hello"}
]
}'Node.js (Server-Side)
// Server-side Node.js execution
const response = await fetch("https://api.mijatovic.io/v1/chat/completions", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": `Bearer ${process.env.MIJATOVIC_API_KEY}`
},
body: JSON.stringify({
model: "adriaticum",
messages: [
{ role: "user", content: "Hello" }
]
})
});
const data = await response.json();Python
# Python requests execution
import os
import requests
response = requests.post(
"https://api.mijatovic.io/v1/chat/completions",
headers={
"Content-Type": "application/json",
"Authorization": f"Bearer {os.environ['MIJATOVIC_API_KEY']}",
},
json={
"model": "adriaticum",
"messages": [
{"role": "user", "content": "Hello"}
],
},
)
data = response.json()