Python: import os import requests class APIClient: def __init__(self, api_key: str, api_secret: str, base_url: str = "https://univie-api.academic-ai.at"): self.api_key = api_key self.api_secret = api_secret self.base_url = base_url def create_chat_completion(self, model: str, messages: list, **kwargs): url = f"{self.base_url}/api/v1/llm/chat" headers = { "X-Client-ID": self.api_key, "X-Client-Secret": self.api_secret, "Content-Type": "application/json", } payload = { "model": model, "messages": messages, **kwargs, } response = requests.post(url, headers=headers, json=payload, timeout=30) response.raise_for_status() return response.json() # Load credentials from environment variables (recommended) # Set these in your environment or .env file: # CLIENT_ID=your-client-id-here # CLIENT_SECRET=your-secret-here api = APIClient( api_key=os.environ["CLIENT_ID"], api_secret=os.environ["CLIENT_SECRET"], ) response = api.create_chat_completion( model="gpt-4o", messages=[{"role": "user", "content": "Hello, how can you help me?"}], temperature=0.7, maxTokens=1000, ) print(f"Response: {response['data']['content']}") print(f"Tokens used: {response['data']['usage']['totalTokens']}") Typescript: class APIClient { private apiKey: string; private apiSecret: string; private baseUrl: string; constructor( apiKey: string, apiSecret: string, baseUrl: string = "https://univie-api.academic-ai.at" ) { this.apiKey = apiKey; this.apiSecret = apiSecret; this.baseUrl = baseUrl; } async createChatCompletion( model: string, messages: Array<{ role: string; content: string }>, options: Record = {} ) { const url = `${this.baseUrl}/api/v1/llm/chat`; const headers = { "X-Client-ID": this.apiKey, "X-Client-Secret": this.apiSecret, "Content-Type": "application/json", }; const payload = { model, messages, ...options, }; const res = await fetch(url, { method: "POST", headers, body: JSON.stringify(payload), }); if (!res.ok) { throw new Error(`Request failed: ${res.status}`); } return res.json(); } } // Load credentials from environment variables (recommended) // Set these in your environment or .env file: // CLIENT_ID=your-client-id-here // CLIENT_SECRET=your-secret-here const api = new APIClient( process.env.CLIENT_ID!, process.env.CLIENT_SECRET!, ); api .createChatCompletion( "gpt-4o", [{ role: "user", content: "Hello, how can you help me?" }], { temperature: 0.7, maxTokens: 1000 } ) .then((response) => { console.log(`Response: ${response.data.content}`); console.log(`Tokens used: ${response.data.usage.totalTokens}`); }) .catch(console.error);