Docs

Quickstart

Get started with AI Hub.

AI Hub gives you ready-made AI APIs, tools and agents, and a catalogue of models, through a single OpenAI-compatible endpoint. One key, and transparent per-token pricing you can read straight from the catalogue.

There are two ways to integrate, depending on how much control you want:

ApproachBest for
REST APIFull control, any language, no dependencies
OpenAI SDKCode that already talks to OpenAI: change the base URL and you are done

Looking for spend caps or rate limits? See Rate limits & caps.

1. Get an API key

Create a key in Console → API Keys. The full key is shown once. Store it as an environment variable, never in code.

bash
export TOKENHUB_API_KEY="sk-tokenhub-…"

Using the AI Hub API

The most direct way in. Send a standard HTTP request to the /v1/chat/completions endpoint from any language or framework.

The examples use deepseek/deepseek-v4-pro. Swap in any slug from the catalogue, or list every available model with GET /v1/models.

import os, requests

r = requests.post(
    "https://tokenhub-api.belive.sg/api/v1/chat/completions",
    headers={
        "Authorization": f"Bearer {os.environ['TOKENHUB_API_KEY']}",
        "Content-Type": "application/json",
    },
    json={
        "model": "deepseek/deepseek-v4-pro",
        "messages": [{"role": "user", "content": "Hello!"}],
    },
)
print(r.json()["choices"][0]["message"]["content"])

The API also supports streaming and tool calling on every model tagged for them.

Using the OpenAI SDK

Point the official OpenAI SDK at AI Hub as a drop-in replacement. Set base_url and your AI Hub key; nothing else in your code changes.

import os
from openai import OpenAI

client = OpenAI(
    base_url="https://tokenhub-api.belive.sg/api/v1",
    api_key=os.environ["TOKENHUB_API_KEY"],
)

r = client.chat.completions.create(
    model="deepseek/deepseek-v4-pro",
    messages=[{"role": "user", "content": "Hello!"}],
)
print(r.choices[0].message.content)

Switch models by changing one string. Every text model on the Models page uses the same API and the same key.

The same key also calls embeddings, image generation, video generation and the ready-made capability endpoints such as translation and OCR.

Next steps

  • AuthenticationKey rules, rotation and what a 401 looks like.
  • ModelsThe live catalogue with pricing, via GET /v1/models.
  • ErrorsThe stable error types, and which ones are safe to retry.
  • Rate limits & capsThe monthly spend cap and the per-key rate limits you can set, and their errors.

For model-specific inputs and limits, start with model discovery, then the endpoint index, OpenAPI reference and error recovery.