Using the API
AI Model Endpoints
AI model endpoints are compatible with the OpenAI API format, so you can use the official OpenAI SDK or any compatible HTTP client.
Authentication
Include your API key in every request using the apikey header:
apikey: <your-api-key>
Finding Your Endpoint
Open Platform → AI Catalog, click on a granted model to see its endpoint URL and model name.
Chat Completions
curl https://aifactory-dev.ai-factory.datalab.tuwien.ac.at/<model-path>/v1/chat/completions \
-H "apikey: <your-api-key>" \
-H "Content-Type: application/json" \
-d '{
"model": "<model-name>",
"messages": [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Explain transformers in one sentence."}
]
}'
Python Example
from openai import OpenAI
client = OpenAI(
base_url="https://aifactory-dev.ai-factory.datalab.tuwien.ac.at/<model-path>/v1",
api_key="<your-api-key>",
)
response = client.chat.completions.create(
model="<model-name>",
messages=[{"role": "user", "content": "Hello!"}],
)
print(response.choices[0].message.content)
Replace <model-path> and <model-name> with the values shown in the catalog for your model.
Infrastructure Services
Infrastructure services (such as the Compute API) have their own REST interface. The full API reference is available via Swagger at aifactory-dev.ai-factory.datalab.tuwien.ac.at/docs. Authentication is the same: use the apikey header.