Examples

This page provides several examples showing how to use the LLMs and API endpoints, whereas the case studies here reference the API endpoint https://llm.hpc.itc.rwth-aachen.de (wird in neuem Tab geöffnet).
More examples (e.g. for vLLM or Ollama) can be found in our Example Collection (wird in neuem Tab geöffnet).
Querying model list
The following example shows how to query available models with curl:
curl https://llm.hpc.itc.rwth-aachen.de/v1/models \
-H "Authorization: Bearer YOUR-API-KEY"Simple completions
The following examples show how to perform a simple completion.
Example for curl:
curl https://llm.hpc.itc.rwth-aachen.de/v1/completions \
-H "Authorization: Bearer YOUR-API-KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "mistralai/Mistral-Small-3.2-24B-Instruct-2506",
"prompt": "San Francisco is a",
"max_tokens": 300
}'Example for OpenAI Python SDK:
import openai
client = openai.OpenAI(
base_url="https://llm.hpc.itc.rwth-aachen.de",
api_key="YOUR-API-KEY"
)
response = client.completions.create(
model="mistralai/Mistral-Small-3.2-24B-Instruct-2506",
prompt="San Francisco is a",
max_tokens=300
)
print(response)Example for Langchain Py:
from langchain_openai import ChatOpenAI, OpenAI
llm = OpenAI(
base_url="https://llm.hpc.itc.rwth-aachen.de",
api_key="YOUR-API-KEY",
model="mistralai/Mistral-Small-3.2-24B-Instruct-2506",
max_tokens=300
)
prompt = "San Francisco is a"
result = llm.invoke(prompt)
print(result)Chat completions
The following examples show how to perform a chat completion.
Example for curl:
curl -X POST https://llm.hpc.itc.rwth-aachen.de/v1/chat/completions \
-H "Authorization: Bearer YOUR-API-KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "mistralai/Mistral-Small-3.2-24B-Instruct-2506",
"messages": [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "San Francisco is a"}
],
"max_tokens": 300
}'Example for OpenAI Python SDK:
import openai
client = openai.OpenAI(
base_url="https://llm.hpc.itc.rwth-aachen.de",
api_key="YOUR-API-KEY"
)
response = client.chat.completions.create(
model="mistralai/Mistral-Small-3.2-24B-Instruct-2506",
messages = [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "San Francisco is a"}
],
max_tokens=300
)
print(response)Example for Langchain Py:
from langchain_openai import ChatOpenAI, OpenAI
llm = ChatOpenAI(
base_url="https://llm.hpc.itc.rwth-aachen.de",
api_key="YOUR-API-KEY",
model="mistralai/Mistral-Small-3.2-24B-Instruct-2506",
max_tokens=300
)
messages = [
("system", "You are a helpful assistant."),
("human", "San Francisco is a"),
]
result = llm.invoke(messages)
print(result.content)