API Reference

The definitive guide to integrating TokenBUS into your production stack.


? Quickstart

Initialize your connection to TokenBUS in under 60 seconds.

TokenBUS provides a high-performance, OpenAI-compatible gateway. No architectural changes are required—simply update your API key and Base URL to begin.

⚡ Step 1: Generate API Key

Access your Dashboard to create a unique API key (sk-...).

?️ Security Recommendation: Immediately configure Usage Quotas in your dashboard settings after key creation. This prevents unauthorized credit depletion in the event of a leaked credential.

⚡ Step 2: Configure Base URL

Point your application to our global edge gateway:

⚡ Step 3: Execute First Request

Verify your integration with DeepSeek-V4-Flash (High Speed / Low Latency):

curl https://api.tokenbus.org/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_TOKENBUS_KEY" \
  -d '{
    "model": "deepseek-v4-flash",
    "messages": [{"role": "user", "content": "Ping!"}]
  }'

? Knowledge Base: Base URL vs. Endpoint

A common point of failure in API integration is incorrect path concatenation. TokenBUS follows industry-standard routing logic to ensure compatibility across all SDKs and manual integrations.

The Logic of Concatenation

  • Base URL (Root): The entry point for SDKs (e.g., OpenAI Python/Node, LangChain, Cursor). These tools automatically append /v1/chat/completions to the provided URL.
  • Full Endpoint: The absolute path for raw HTTP calls (e.g., curl, Postman).

Configuration Mapping

Integration ScenarioField NameRecommended URL
SDK / Integrated SoftwareAPI Base / Base URLhttps://api.tokenbus.org/
Native HTTP RequestPOST URLhttps://api.tokenbus.org/v1/chat/completions

⚠️ Common Pitfalls

  • Double Versioning: If you set the Base URL to https://api.tokenbus.org/v1, some SDKs may attempt to call .../v1/v1/..., resulting in a 404 Not Found error.
  • Trailing Slashes: While our gateway handles trailing slashes gracefully, we recommend using https://api.tokenbus.org/ without additional pathing for maximum compatibility.