TokenHub API Documentation

Fully OpenAI-compatible API · One line of code to switch

Base URL

https://loyap-innovation.com/v1/

Authentication

Pass your API Key in the Authorization header:

Authorization: Bearer sk-your-tokenhub-key

Get your API key →

Available Models

Model NameProviderContextPrice (per 1M tokens)
deepseek-chatDeepSeek64K$0.27
deepseek-v3.2DeepSeek128K$0.27
deepseek-r1DeepSeek (Reasoning)64K$0.55
qwen-plusAlibaba Qwen131K$0.11
qwen-maxAlibaba Qwen32K$0.28
glm-4-flashZhipu GLM128KFree
glm-5Zhipu GLM128K$0.14
doubao-proByteDance128K$0.14
doubao-liteByteDance128K$0.01
kimi-k2.5Moonshot AI128K$0.14
gpt-4oOpenAI (via proxy)128K$2.50
claude-sonnet-4Anthropic (via proxy)200K$3.00

500+ more models available. Visit admin panel for the full list.

Chat Completions

POST/v1/chat/completions

Python (OpenAI SDK)

from openai import OpenAI

client = OpenAI(
    api_key="sk-your-tokenhub-key",
    base_url="https://loyap-innovation.com/v1/"
)

response = client.chat.completions.create(
    model="deepseek-chat",
    messages=[
        {"role": "system", "content": "You are a helpful AI."},
        {"role": "user", "content": "Hello!"}
    ],
    temperature=0.7,
    stream=True
)

for chunk in response:
    print(chunk.choices[0].delta.content or "", end="")

JavaScript (Node.js)

import OpenAI from 'openai';

const client = new OpenAI({
    apiKey: "sk-your-tokenhub-key",
    baseURL: "https://loyap-innovation.com/v1/"
});

const stream = await client.chat.completions.create({
    model: "deepseek-chat",
    messages: [{ role: "user", content: "Hello" }],
    stream: true,
});

for await (const chunk of stream) {
    process.stdout.write(chunk.choices[0]?.delta?.content || "");
}

curl

curl https://loyap-innovation.com/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer sk-your-tokenhub-key" \
  -d '{
    "model": "deepseek-chat",
    "messages": [
      {"role": "system", "content": "You are a helpful AI."},
      {"role": "user", "content": "Hello!"}
    ],
    "temperature": 0.7,
    "stream": true
  }'

Streaming

Set stream: true to receive Server-Sent Events (SSE) responses. Fully compatible with OpenAI's streaming format.

Live Demo

Try it without coding: Free Trial → or use the Chat Demo →

Get an API Key

  1. Go to /token/ and create an account
  2. Generate a new API key
  3. Use it with the code above

Need Help?

Contact us via WeChat: TokenHub_Support


← Back to TokenHub