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.
Prerequisites
Section titled “Prerequisites”- Python 3.10 or newer and a terminal. Basic knowledge of running a Python script is assumed.
- A maKI API key for the
self-hostedmodel 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.
1. Prepare a Python environment
Section titled “1. Prepare a Python environment”Open a working directory for the example. On macOS or Linux:
python3 -m venv .venvsource .venv/bin/activatepython -m pip install openaiOn Windows (PowerShell), you can use the environment’s Python executable directly:
py -3 -m venv .venv.\.venv\Scripts\python.exe -m pip install openai2. Send your first request
Section titled “2. Send your first request”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 osfrom getpass import getpassfrom 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:
python first_response.pyOn Windows, use this command instead:
.\.venv\Scripts\python.exe first_response.py3. Check the result
Section titled “3. Check the result”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.
More examples (optional)
Section titled “More examples (optional)”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.
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?"}] }'Streaming
Section titled “Streaming”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="")Embeddings
Section titled “Embeddings”response = client.embeddings.create( model="jina-embeddings-v2-base-de", input="Ein Beispielsatz auf Deutsch",)
print(response.data[0].embedding[:5]) # First 5 dimensionsTranscription
Section titled “Transcription”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)curl https://maki.uni-mannheim.de/v1/audio/transcriptions \ -H "Authorization: Bearer ${MAKI_API_KEY}" \ -F model="parakeet-v3" \ -F file="@recording.wav"Health Check
Section titled “Health Check”curl https://maki.uni-mannheim.de/healthFurther API documentation
Section titled “Further API documentation”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.