API Reference
The Thtolen API is compatible with the OpenAI REST API. Point an existing client at the Thtolen base URL and use a Thtolen API key; request and response bodies are unchanged.
Base URL
https://api.thtolen.top/v1
All endpoints are served over HTTPS only (TLS 1.2+, HTTP/2). Plain HTTP requests are rejected.
Authentication
Authenticate every request with a workspace API key in the Authorization header. Keys are created in the console by workspace members; access to the console is by invitation only.
Authorization: Bearer tt-live-••••••••••••••••
Requests without a valid key receive 401 invalid_api_key. Keys can be scoped to specific models and given a monthly budget.
Endpoints
| Method | Path | Description |
|---|---|---|
| POST | /v1/chat/completions | Chat completions, streaming or non-streaming |
| POST | /v1/responses | Responses API, including tool calls |
| POST | /v1/embeddings | Text embeddings, up to 2,048 inputs per request |
| GET | /v1/models | Models enabled for the key's workspace |
| POST | /v1/files | Upload a file for batch jobs or retrieval (up to 100 MB) |
| POST | /v1/batches | Create an asynchronous batch job, completed within 24 hours |
Set "model": "auto" to let the gateway choose a provider by latency and availability, or pass a specific model ID returned by /v1/models.
Streaming
Set "stream": true to receive server-sent events. Connections stay open for the whole generation, up to 60 minutes. The gateway sends a : keep-alive comment every 15 seconds so that idle proxies do not close long-running streams.
curl https://api.thtolen.top/v1/chat/completions \ -H "Authorization: Bearer $THTOLEN_API_KEY" \ -H "Content-Type: application/json" \ -d '{"model": "auto", "stream": true, "messages": [{"role": "user", "content": "Hello"}]}' data: {"id":"chatcmpl-…","choices":[{"delta":{"content":"Hi"}}]} : keep-alive data: [DONE]
Using an SDK
Any OpenAI-compatible SDK works by changing the base URL.
import os from openai import OpenAI client = OpenAI( base_url="https://api.thtolen.top/v1", api_key=os.environ["THTOLEN_API_KEY"], ) stream = client.chat.completions.create( model="auto", stream=True, messages=[{"role": "user", "content": "Hello"}], )
Limits
| Request payload | 100 MB |
| Streaming session | 60 minutes |
| Concurrent streams | 64 per key (default) |
| Rate limits | Per key; current values are returned in x-ratelimit-* response headers |
Errors
Errors use the OpenAI error format.
HTTP/2 401
content-type: application/json
{"error":{"message":"Invalid API key. Access to this gateway is by invitation only.","type":"invalid_request_error","code":"invalid_api_key"}}| Status | Code | Meaning |
|---|---|---|
| 401 | invalid_api_key | Missing, revoked or unknown key |
| 403 | model_not_allowed | The key is not scoped to the requested model |
| 413 | payload_too_large | Request body exceeds 100 MB |
| 429 | rate_limit_exceeded | Per-key rate limit or monthly budget reached |
| 502 | upstream_error | All upstream providers failed; safe to retry |