SovrGPT Docs
API

POST /v1/chat/completions

Der Hauptendpoint — identisches Schema wie OpenAI.

Erzeugt eine Modell-Antwort auf eine Chat-Konversation.

curl https://sovrgpt.com/api/v1/chat/completions \
  -H "Authorization: Bearer $SOVR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "qwen3.5-9b",
    "messages": [
      { "role": "system", "content": "Du bist ein hilfreicher Assistent." },
      { "role": "user",   "content": "Erkläre Diffusionsmodelle in zwei Sätzen." }
    ],
    "temperature": 0.5,
    "max_tokens": 400
  }'

Request-Body

FeldTypDefaultBeschreibung
modelstringModell-ID aus GET /v1/models.
messagesarrayKonversation. Roles: system, user, assistant, tool.
temperaturenumber0.70.0 – 2.0. Höher = kreativer.
top_pnumber1.0Nucleus-Sampling.
max_tokensintmodel-defaultMaximale Antwort-Länge in Tokens.
streamboolfalseTrue → SSE-Stream.
stopstring|arrayStop-Sequenzen.
toolsarrayOpenAI-Tool-Schema (Function-Calling).
tool_choicestring|object"auto""none", "auto", "required", oder spezifisches Tool.
response_formatobject{ "type": "json_object" } für JSON-Modus.

Ignoriert (nicht crashend): seed, logit_bias, user, n (>1 nicht unterstützt), presence_penalty, frequency_penalty.

Antwort (non-streaming)

{
  "id": "chatcmpl-abc123",
  "object": "chat.completion",
  "created": 1715520000,
  "model": "qwen3.5-9b",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "Diffusionsmodelle …"
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 42,
    "completion_tokens": 87,
    "total_tokens": 129
  }
}

Streaming (SSE)

Mit "stream": true oder Accept: text/event-stream:

data: {"id":"chatcmpl-abc","choices":[{"delta":{"role":"assistant"},"index":0}]}
data: {"id":"chatcmpl-abc","choices":[{"delta":{"content":"Diff"},"index":0}]}
data: {"id":"chatcmpl-abc","choices":[{"delta":{"content":"usions"},"index":0}]}

data: {"id":"chatcmpl-abc","choices":[{"delta":{},"finish_reason":"stop","index":0}]}
data: [DONE]

Format ist mit OpenAI identisch — der OpenAI-SDK-stream: true-Modus funktioniert ohne Änderungen.

Vision-Input

Nur bei Modellen mit accepts_vision: true (vision-Tier, default-Tier ab 3.5):

{
  "model": "gemma-4-26b-a4b",
  "messages": [
    {
      "role": "user",
      "content": [
        { "type": "text", "text": "Was ist auf dem Bild?" },
        { "type": "image_url", "image_url": { "url": "https://…/foto.jpg" } }
      ]
    }
  ]
}

image_url.url kann eine Public-URL oder ein Base64-Data-URL sein (data:image/png;base64,…).

Function-Calling / Tools

Vollständig OpenAI-kompatibel. Beispiel:

{
  "model": "qwen3.5-9b",
  "messages": [{ "role": "user", "content": "Was kostet ein Bitcoin?" }],
  "tools": [{
    "type": "function",
    "function": {
      "name": "get_price",
      "description": "Holt aktuellen Preis",
      "parameters": {
        "type": "object",
        "properties": { "symbol": { "type": "string" } },
        "required": ["symbol"]
      }
    }
  }]
}

Die Antwort enthält tool_calls analog zu OpenAI. Der Client führt die Funktion aus und schickt das Ergebnis als role: "tool"-Message zurück.

Fehler & Reasoning

Bei reasoning-Tier-Modellen enthält die Antwort zusätzlich <think>…</think>- Blöcke vor der finalen Antwort. UIs können das ein- oder ausblenden — das SovrGPT-UI klappt sie standardmäßig zu.

POST /v1/chat/completions