Skip to content

Quick Start

In this quick start, you send a question to maKI from a Python script and read the response in your terminal. Once a text response appears, you have completed this learning path.

  • Python 3.10 or newer and a terminal. Basic knowledge of running a Python script is assumed.
  • A maKI API key for the self-hosted model group. Select this group in the API-key form (German). See API Keys for key types and handling.
  • A connection to https://maki.uni-mannheim.de. Use List models to check which models your key can access.

You request access to model groups. In an API request, you specify a model name. This example uses gemma4-26b from the self-hosted group.

Open a working directory for the example. On macOS or Linux:

Terminal window
python3 -m venv .venv
source .venv/bin/activate
python -m pip install openai

On Windows (PowerShell), you can use the environment’s Python executable directly:

Terminal window
py -3 -m venv .venv
.\.venv\Scripts\python.exe -m pip install openai

Save the following code as first_response.py. The key is entered at a hidden terminal prompt; do not put it in the Python file. If MAKI_API_KEY is already set in your environment, the example uses that value.

import os
from getpass import getpass
from openai import OpenAI
api_key = os.environ.get("MAKI_API_KEY") or getpass("maKI API key: ")
client = OpenAI(
base_url="https://maki.uni-mannheim.de/v1",
api_key=api_key,
)
response = client.chat.completions.create(
model="gemma4-26b",
messages=[{"role": "user", "content": "What is the capital of France?"}],
)
print(response.choices[0].message.content)

Run the script in your terminal:

Terminal window
python first_response.py

On Windows, use this command instead:

Terminal window
.\.venv\Scripts\python.exe first_response.py

Expect a text response naming Paris. The exact wording may vary. You have now used an API key, sent a chat request and extracted the response text.

If you receive an error, follow Troubleshooting: for 401, check the key first; for an unknown model, check its name and the model list available to your key.

You have completed the quick start. The following examples are optional next tasks. Python examples reuse the client above; run them in the same script after the first request. For curl, MAKI_API_KEY must be set in your shell. The model examples below also belong to the self-hosted group.

Terminal window
curl https://maki.uni-mannheim.de/v1/chat/completions \
-H "Authorization: Bearer ${MAKI_API_KEY}" \
-H "Content-Type: application/json" \
-d '{
"model": "gemma4-26b",
"messages": [{"role": "user", "content": "What is the capital of France?"}]
}'

Pass stream=True for token-by-token responses:

stream = client.chat.completions.create(
model="gemma4-26b",
messages=[{"role": "user", "content": "Explain quantum computing"}],
stream=True,
)
for chunk in stream:
if chunk.choices and chunk.choices[0].delta.content:
print(chunk.choices[0].delta.content, end="")
response = client.embeddings.create(
model="jina-embeddings-v2-base-de",
input="Ein Beispielsatz auf Deutsch",
)
print(response.data[0].embedding[:5]) # First 5 dimensions

Transcribe audio files (WAV, MP3, FLAC, OGG):

audio_file = open("recording.wav", "rb")
transcription = client.audio.transcriptions.create(
model="parakeet-v3",
file=audio_file,
)
print(transcription.text)
Terminal window
curl https://maki.uni-mannheim.de/v1/audio/transcriptions \
-H "Authorization: Bearer ${MAKI_API_KEY}" \
-F model="parakeet-v3" \
-F file="@recording.wav"
Terminal window
curl https://maki.uni-mannheim.de/health

maKI is built on LiteLLM. The API is OpenAI-compatible — for detailed descriptions of all endpoints, parameters, and SDK examples see the LiteLLM proxy documentation and the OpenAI API reference. Always use https://maki.uni-mannheim.de/v1 as the base_url.