REFERENCE

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 Hosthttps://api.mijatovic.io
Base URLhttps://api.mijatovic.io/v1
EndpointPOST /v1/chat/completions
Supported Modeladriaticum

Authentication

Requests must supply an active API key using standard HTTP Bearer authentication:

Header
Authorization: Bearer $MIJATOVIC_API_KEY

API 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.

ParameterTypeRequiredDescription
modelstringYesMust be set to adriaticum.
messagesarrayYesArray of 1–20 message objects with role (system, user, or assistant) and string content (max 10,000 characters each).
temperaturenumberNoSampling temperature between 0.0 and 2.0 (default 0.7).
max_tokensintegerNoMaximum 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:

200 OK Response
{
  "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 Envelope
{
  "error": {
    "code": "invalid_api_key",
    "message": "The provided API key is invalid or has been revoked.",
    "request_id": "chatcmpl_9a8b7c6d5e4f3a2b1c0d9e8f7a6b5c4d"
  }
}
StatusError CodeDescription
400invalid_requestMalformed JSON, missing required fields, or unsupported parameters.
401invalid_api_keyMissing Authorization header, malformed key, or revoked credential.
403insufficient_permissionAPI key lacks permission to execute completions.
404not_foundUnknown route or request sent to non-API host.
413payload_too_largeRequest body exceeds 256 KB.
502inference_errorInference service communication error.
503search_unavailableFactual grounding required Search, but Search was unavailable.
503service_unavailableInference 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
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)

Node.js
// 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
# 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()