Authentication
AI Foundation Services uses API keys for authentication. All requests must include your API key in the Authorization header.
Get an API key
Section titled “Get an API key”Free trial key
Section titled “Free trial key”Get started immediately with a free trial key:
- Visit the API Key Portal
- Create an account and generate your API key
- Your trial key unlocks all models, including Premium models
Production key
Section titled “Production key”For production workloads, contact us.
Set up environment variables
Section titled “Set up environment variables”Store your API key as an environment variable — never hardcode it in your source code.
export OPENAI_API_KEY ="your_api_key_here" export OPENAI_BASE_URL ="https://llm-server.llmhub.t-systems.net/v2" To persist across sessions, add these lines to your ~/.zshrc or ~/.bashrc file.
$env:OPENAI_API_KEY = "your_api_key_here" $env:OPENAI_BASE_URL = "https://llm-server.llmhub.t-systems.net/v2" setx OPENAI_API_KEY "your_api_key_here" setx OPENAI_BASE_URL "https://llm-server.llmhub.t-systems.net/v2" Using the API key
Section titled “Using the API key”With OpenAI SDKs
Section titled “With OpenAI SDKs”When OPENAI_ and OPENAI_ are set, the OpenAI SDKs pick them up automatically:
from openai import OpenAI
client = OpenAI() # No need to pass api_key or base_url You can also pass them explicitly:
from openai import OpenAI
client = OpenAI( api_key ="your_api_key_here" , base_url ="https://llm-server.llmhub.t-systems.net/v2" ,)With HTTP requests
Section titled “With HTTP requests”Include the API key in the Authorization header:
curl -X POST "https://llm-server.llmhub.t-systems.net/v2/chat/completions" \ -H "Authorization: Bearer $OPENAI_API_KEY " \ -H "Content-Type: application/json" \ -d '{"model": "gpt-oss-120b", "messages": [{"role": "user", "content": "Hello"}]}' Base URL
Section titled “Base URL”All API requests go to:
https://llm-server.llmhub.t-systems.net/v2 This is the OpenAI-compatible endpoint. For the full API specification, see the API Reference.
Best practices
Section titled “Best practices”- Never commit API keys to version control. Use
.files and add them toenv ..gitignore - Use environment variables in production rather than hardcoding keys.
- Rotate keys regularly via the API Key Portal.
- Monitor usage through the API Key Portal to track token consumption and costs.
Next steps
Section titled “Next steps”- Quickstart sends the first chat request with this key.
- Recommended models picks a live model.
- Error codes covers 401 and 403.