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

MethodPathDescription
POST/v1/chat/completionsChat completions, streaming or non-streaming
POST/v1/responsesResponses API, including tool calls
POST/v1/embeddingsText embeddings, up to 2,048 inputs per request
GET/v1/modelsModels enabled for the key's workspace
POST/v1/filesUpload a file for batch jobs or retrieval (up to 100 MB)
POST/v1/batchesCreate 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
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.

Python
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 payload100 MB
Streaming session60 minutes
Concurrent streams64 per key (default)
Rate limitsPer 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"}}
StatusCodeMeaning
401invalid_api_keyMissing, revoked or unknown key
403model_not_allowedThe key is not scoped to the requested model
413payload_too_largeRequest body exceeds 100 MB
429rate_limit_exceededPer-key rate limit or monthly budget reached
502upstream_errorAll upstream providers failed; safe to retry