Skip to content

Latest commit

 

History

History
185 lines (129 loc) · 12.9 KB

api.md

File metadata and controls

185 lines (129 loc) · 12.9 KB

All hostnames in the examples are placeholders; use the actual hostname from the private deployment configuration.

Programmatic Access to the Kolibri Assistant

Status: November 29, 2026. The public endpoint was successfully tested with a login token and stream: false. The response contained model: STACKIT-Assistent, the response text, and research_trace.

Endpoint and Model Profile

Setting Value
URL https://kolibri.example.com/api/chat/completions
Method POST
Format OpenAI-compatible chat completions request and response
Model ID STACKIT-Assistent
Authentication Authorization: Bearer <TOKEN>
Content Type Content-Type: application/json

With model: STACKIT-Assistent, the customized flow is executed: general answers, demand-dependent tool selection, PIM, repository and web research, as well as Terraform checks if applicable. The API client does not need to call these tools itself. Details: Demand-dependent tools.

Kolibri-1.1 refers to the direct model profile without this automatic extension. The local model server on port 8000 is also not the entry point for the customized assistant. Public access occurs via HTTPS and the user login of Open WebUI.

Authentication

Already usable: Login Token

Log in with an existing WebUI user account:

POST /api/v1/auths/signin
Content-Type: application/json

{
  "email": "DEINE-E-MAIL-ADRESSE",
  "password": "DEIN-PASSWORT"
}

The field token of the JSON response is then passed as a Bearer token. The credentials are those of the personal WebUI account, not the STACKIT service account file. A login token is a session token; re-login is necessary upon expiration. The Python example below keeps password and token only in memory and does not output them.

For regular integrations: personal API keys

During the test on November 29, 2026, ENABLE_API_KEYS was set to false. The API key function was not activated by the documentation; the already tested login uses a login token.

The following steps are provided in Open WebUI for API keys:

  1. As an administrator under Settings → Authentication → API Keys, activate the function and save.
  2. If necessary, grant non-administrators the API Keys permission via a suitable user group.
  3. In the respective user account under Settings → Account → API keys / Secrets, create a key.
  4. Use this key instead of the login token in the Bearer header.

An API key takes over the permissions of the associated account. If API key endpoint restrictions are activated, the used path /api/chat/completions must be released. Operation and permissions are described in the Open WebUI API keys documentation.

Single Request with curl

KOLIBRI_TOKEN must be filled beforehand with a valid login token or a personal API key to be activated in the future.

curl --fail-with-body --max-time 630 \
  https://kolibri.example.com/api/chat/completions \
  -H "Authorization: Bearer $KOLIBRI_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "STACKIT-Assistent",
    "stream": false,
    "messages": [
      {
        "role": "user",
        "content": "Welche STACKIT-Flavors haben 4 vCPUs?"
      }
    ]
  }'

The response text is under choices[0].message.content. The additional field research_trace contains diagnostic data such as selected plugins, sources, and call counts. It belongs to our extension, not to the general OpenAI format.

Python: Login and Follow-up Question

The example uses only the Python standard library. It queries its own credentials interactively and sends the actual previous conversation history with the follow-up question.

import getpass
import json
import urllib.request

BASE_URL = "https://kolibri.example.com"


def post(path, payload, token=None):
    headers = {"Content-Type": "application/json"}
    if token:
        headers["Authorization"] = f"Bearer {token}"
    request = urllib.request.Request(
        BASE_URL + path,
        data=json.dumps(payload).encode("utf-8"),
        headers=headers,
        method="POST",
    )
    with urllib.request.urlopen(request, timeout=630) as response:
        return json.load(response)


login = post("/api/v1/auths/signin", {
    "email": input("WebUI-E-Mail: "),
    "password": getpass.getpass("WebUI-Passwort: "),
})
token = login["token"]
del login
messages = []


def ask(question):
    messages.append({"role": "user", "content": question})
    result = post("/api/chat/completions", {
        "model": "STACKIT-Assistent",
        "stream": False,
        "messages": messages,
    }, token)
    answer = result["choices"][0]["message"]["content"]
    messages.append({"role": "assistant", "content": answer})
    return answer


print(ask("What is DNS?"))
print(ask("Please explain this with a simple example."))

For a new independent chat, empty messages. Without a sent history, the assistant cannot reliably resolve references like "that". No WebUI chat ID is required for this call style.

Response Behavior and Limits

  • The examples use the tested variant stream: false: An HTTP request delivers the complete answer after processing. The browser's progress notifications do not appear as intermediate responses in this mode.
  • The backend flow currently has a processing budget of 300 seconds for the extended profile; direct requests have a 600-second upstream timeout. The examples give the HTTP client 630 seconds; a higher client limit may be useful during queues. A single inference slot means that simultaneous requests may wait.
  • HTTP errors should be handled by the client. Additionally, a technical or internal error message may be in the response text; research_trace.error may be set upon backend aborts. HTTP 200 alone is therefore not proof of quality.
  • For the customized profile, the relevant response and research parameters come from assistant/. Additional OpenAI request fields are not automatically supported configuration overrides.
  • The adjustments are the same flow as in the chat, not additionally trained model weights. The known technical limitations also apply to API access.

The general interface reference is in the Open WebUI API documentation. For this installation, /api/chat/completions was specifically checked; this guide requires no additional public /v1 proxy.

Context and output budgets

The reference deployment serves 65,536 context tokens per request and defaults to 8,192 output tokens for both managed profiles. The context includes the formatted prompt, system instructions, tool definitions/results, history, reasoning and generated output; it is not an input-only allowance. The gateway also reserves 256 safety tokens. With the default output reservation, at most 57,088 tokens remain for the formatted input before context fitting. Very long histories or tool results may be compacted; an oversized current request can still be rejected.

The previous 2,048-token value was the direct profile's default, not a native Kolibri model limit. The older standalone bootstrap allocated 8,192 context tokens while Compose used 16,384; both now allocate 65,536. The official Kolibri 1.1 model card describes a native context of 262,144 tokens. This deployment intentionally uses a smaller operational allocation; increasing it further requires a GPU-memory and latency check.

  • Direct Kolibri-1.1: omitting max_tokens uses the managed 8,192-token default. An explicit positive max_tokens overrides that default, subject to the available context. For integration compatibility, use max_tokens; max_completion_tokens is not a supported gateway alias. Reasoning can consume part of the output budget. A model may finish before the maximum.
  • Extended STACKIT-Assistent: final answer budgets are controlled by the profile, limits.knowledge_tokens, and the Terraform plugin's options.tokens. All three are set to 8,192. Per-request max_tokens is not an override of the managed research workflow. Planning remains separately bounded.
  • Client configuration: also raise any local response-token cap or timeout in the integrating software. Existing chat-level settings can still send an explicit 2,048-token value; changing a server default cannot override an explicit client request. Inspect finish_reason: "length" on direct responses for output truncation.

Operational values live in compose.yaml, scripts/install.sh, assistant/assistant.yaml, assistant/profiles/*.yaml and assistant/plugins/terraform/plugin.yaml. Change the model server's context allocation first, then apply the matching assistant bundle; the online configuration check rejects a budget larger than the running slot. The direct timeout is configurable as runtime.direct_timeout_seconds. Use stream: true for long direct responses so the client receives output while generation runs.

Public API acceptance on December 1, 2026: a direct request without max_tokens returned 2,692 output tokens with finish_reason: "stop". A separate request processed 28,873 input tokens and recovered three synthetic markers from the beginning, middle and end. The running model slot reported 65,536 tokens. These checks verify the raised budgets and request path, not answer quality across all long-context tasks.

Media Requests

Via the same chat endpoint and model ID STACKIT-Assistent, image and video requests are possible, e.g., "Generate an image of a hummingbird" or "Create a three-second video of a paper airplane". Use streaming and a client timeout of at least 1,200 seconds. Status messages contain real generation steps. The final chat response contains Markdown images or a multi-line <video> block with URL plus download links; API clients must render this themselves. Links are signed read permissions for exactly one request, valid for 30 days by default. A separate public Images/Videos API is not provided. Details and storage locations: MEDIA.md.

Language and model compatibility

The visible profile name is STACKIT Assistant. Keep using STACKIT-Assistent as the API model ID; it remains stable for existing clients and chats. Instructions and fixed progress messages use English. Generated answers follow the language of the current request or an explicitly requested language.

Planned images also return a signed Download image plan (JSON) link. The plan describes intent, not verified pixels. Automatic diagram review is disabled by default; clients must not interpret a completed render as confirmation that its connections match the plan. The versioned graph contract and internal plan endpoints are documented in structured image plans. Future renderers can consume that plan without parsing chat text or extracting connections from pixels.

Image inputs

The extended profile accepts OpenAI-style multimodal messages at the same endpoint:

import base64
from pathlib import Path

image = base64.b64encode(Path("screenshot.png").read_bytes()).decode()
messages = [{"role": "user", "content": [
    {"type": "text", "text": "Explain this screenshot and read its visible text."},
    {"type": "image_url", "image_url": {"url": "data:image/png;base64," + image}}
]}]
# Pass messages with model="STACKIT-Assistent" through the authenticated chat API.

For edits, ask for the change in the text part; for image-to-video, describe the desired movement. Use PNG, JPEG or WebP data URIs. Arbitrary HTTP URLs and filesystem paths are rejected. Signed images previously generated by this application can be reused from assistant history; the media service verifies the signature and reads the local artifact without network access. Keep prior user/assistant messages for follow-ups or attach the image again. Do not send image input to the direct Kolibri-1.1 profile.

Image analysis returns ordinary answer text. Edits and videos return the same signed artifacts described above. Uploaded images are limited to 10 MiB and 20 megapixels each, two images per operation, one for video. The UI normalizes its authenticated uploads to this data-URI format before calling the assistant. The model router receives only text and attachment markers; image bytes go to the selected local image model.

For spoken recordings, music and videos with sound, describe the complete desired result in the chat request. The assistant runs the required components automatically and returns an audio/video player and download link. Use streaming and a long client timeout; see audio and soundtracks for examples and limits.

Longer films use the same chat API and STACKIT-Assistent profile. Describe the total duration (up to sixty seconds), desired content and optional soundtrack in one request. The active composition extension plans and edits the clips automatically. No separate clip API workflow is required; very long-running jobs return the existing signed result-page link.