TTokensHub

Developer documentation

Connect in minutes.

TokensHub provides a prepaid, OpenAI-compatible chat completions endpoint. Use your own secure API key and only pay from your available credit balance.

Endpoint

POST /v1/chat/completions

Authentication

Bearer sk-th-…

Rate limit

60 requests / min / key

Authentication

Verify your email, create a key in the dashboard, and keep the plaintext key in a secret manager. TokensHub displays a new key only once.

Authorization: Bearer sk-th-your-key

Base URL

https://api.tokenshub.com.au/v1

cURL

curl https://api.tokenshub.com.au/v1/chat/completions \
  -H "Authorization: Bearer sk-th-your-key" \
  -H "Content-Type: application/json" \
  -d '{"model":"your-model","messages":[{"role":"user","content":"Hello"}]}'

Python

from openai import OpenAI

client = OpenAI(
  api_key="sk-th-your-key",
  base_url="https://api.tokenshub.com.au/v1",
)
response = client.chat.completions.create(
  model="your-model",
  messages=[{"role": "user", "content": "Hello"}],
)

Node.js

import OpenAI from "openai";

const client = new OpenAI({
  apiKey: "sk-th-your-key",
  baseURL: "https://api.tokenshub.com.au/v1",
});
const response = await client.chat.completions.create({
  model: "your-model",
  messages: [{ role: "user", content: "Hello" }],
});

Streaming

Set stream: true to receive server-sent events as the response is generated. Usage is measured from the final event; if an upstream provider omits usage, TokensHub records a tiktoken estimate and marks it in your dashboard.

Credits and errors

StatusMeaningCredits
200Completed requestUsage deducted
401Invalid or revoked API keyNot deducted
402No available creditsNot deducted
429 / 5xxRate limited or upstream unavailableNot deducted
TokensHub