Sie befinden sich im Service: LLM Hosting

Examples

Examples

information

This page contains different examples on how you can use the LLMs.

More examples (e.g. for vLLM or Ollama) can be found in our Example Collection.


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)

zuletzt geändert am 15.09.2025

Wie hat Ihnen dieser Inhalt geholfen?

Creative Commons Lizenzvertrag
Dieses Werk ist lizenziert unter einer Creative Commons Namensnennung - Weitergabe unter gleichen Bedingungen 3.0 Deutschland Lizenz