TokenDance Gateway
Public integration notes, credential boundaries, and productization roadmap for the model API gateway.
What it is
TokenDance Gateway provides a unified model API entry point. Developers and agents can point OpenAI-compatible SDKs at the Gateway base URL and call models with a TokenDance API key.
The productization goal is to make keys, quota, usage, models, common errors, and SDK examples readable, governed, and auditable.
Credential boundary
| Credential | Used for | Not for |
|---|---|---|
| TokenDance API key | Calling https://api.vectorcontrol.tech/v1 model APIs | Logging into TokenDance ID or admin surfaces |
| TokenDance ID session | Browser login, admin identity, low-risk personalization | Direct model API bearer token |
| Provider upstream key | Controlled server-side provider access | Public docs, frontend code, or card payloads |
Implementation names are not public product names
Public pages should use TokenDance Gateway as the product name. NewAPI, MetAPI, Codex2API, Portal, mihomo proxy-gateway, and similar names are implementation/runtime components, not user-facing brands for public navigation, headings, or marketing copy.
When implementation boundaries matter, say that Gateway is supported by controlled runtime components, but do not expose private deploy paths, hostnames, upstream keys, admin tokens, database paths, or rollback commands.
OpenAI-compatible call
This is a public-safe example. Real keys must come from a controlled key issuance flow, and model names should follow the current accessible model list.
curl https://api.vectorcontrol.tech/v1/chat/completions \
-H "Authorization: Bearer $TOKENDANCE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "your-model",
"messages": [{"role": "user", "content": "Hello"}]
}' Quickstart
- Confirm you have a TokenDance API key, not a TokenDance ID access token.
- Point your SDK base URL at https://api.vectorcontrol.tech/v1.
- Start with a models request or minimal chat completions request to validate key, model name, and network path.
- Store the key in server-side secret storage, a local environment variable, or a controlled CI secret, not a frontend bundle.
- Record request id, model name, status code, and error code for support.
Environment variables
| Variable | Purpose | Public-doc requirement |
|---|---|---|
| TOKENDANCE_API_KEY | Credential for TokenDance Gateway model API calls | Show the variable name only, never a real value |
| TOKENDANCE_BASE_URL | OpenAI-compatible base URL, defaulting to https://api.vectorcontrol.tech/v1 | The public URL is safe; internal gateways and admin surfaces are not |
| TOKENDANCE_MODEL | Model name or alias used by the request | Examples use your-model; real model catalogs need controlled publication |
| TOKENDANCE_REQUEST_ID | Request id captured for support | Redacted request ids are acceptable; raw provider payloads are not |
Minimal verification request
Start with a read-only or low-cost request to confirm key, base URL, model name, and network path before wiring an agent, CI job, or backend service.
$env:TOKENDANCE_BASE_URL = "https://api.vectorcontrol.tech/v1"
curl.exe "$env:TOKENDANCE_BASE_URL/models" -H "Authorization: Bearer $env:TOKENDANCE_API_KEY" Node / TypeScript SDK example
Gateway works with OpenAI SDK baseURL configuration. Public docs show environment variable names only, not real keys or internal model names.
import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.TOKENDANCE_API_KEY,
baseURL: "https://api.vectorcontrol.tech/v1",
});
const result = await client.chat.completions.create({
model: process.env.TOKENDANCE_MODEL ?? "your-model",
messages: [{ role: "user", content: "Hello from TokenDance Gateway" }],
});
console.log(result.choices[0]?.message?.content); Python SDK example
Python uses the same OpenAI-compatible client pattern. Applications should read keys from server-side environment variables and never bundle keys into frontend code.
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["TOKENDANCE_API_KEY"],
base_url="https://api.vectorcontrol.tech/v1",
)
response = client.chat.completions.create(
model=os.environ.get("TOKENDANCE_MODEL", "your-model"),
messages=[{"role": "user", "content": "Hello from TokenDance Gateway"}],
)
print(response.choices[0].message.content) Agent workload configuration
| Client | Recommended configuration | Notes |
|---|---|---|
| AgentHub | Configure Gateway base URL and API key in the runtime adapter or controlled server side | Desktop/Web do not store model keys; Hub sessions are not model API keys |
| Codex / Claude Code style CLI | Use the OpenAI-compatible base URL and local environment variables | Do not write keys into project config files, issues, screenshots, or logs |
| TokenDanceCode | Prefer environment variables that point to Gateway as an experimental CLI entry | OpenAI provider mapping exists; CLI auto-selection is not a default promise yet |
| CI / automation | Inject `TOKENDANCE_API_KEY` through controlled CI secrets | Do not copy raw responses, prompts, or file paths into public docs |
Models, errors, and status
| Topic | Current public promise | In progress |
|---|---|---|
| Models | Gateway exposes model calls through an OpenAI-compatible API | Public model list, aliases, context windows, and availability notes |
| Errors | Errors should include stable code, message, and request id | Common provider, quota, rate-limit, and auth error tables |
| Rate limits | Quota and rate limits are governed by Gateway | Visible quota and reset windows per key, user, and organization |
| Status | API is live; productized docs are still improving | Public status surface, provider health, and degradation semantics |
Common error-code direction
| Error type | Check first | Docs status |
|---|---|---|
| Authentication failed | Authorization header, whether the key belongs to TokenDance Gateway, and whether a TokenDance ID access token was used by mistake | Error table in progress |
| Model not found | model name, model alias, and whether the key can access that model | Public model list in progress |
| Quota or rate limit | key team, quota, reset window, and concurrent requests | Quota view in progress |
| Provider degradation | request id, time, model name, degradation, and retry behavior | Status vocabulary in progress |
| Request schema invalid | OpenAI-compatible payload, messages, tools, and stream parameters | SDK examples being expanded |
What to provide for support
- Request time, HTTP status, error code, request id, and model name.
- SDK name and version, and whether the base URL is https://api.vectorcontrol.tech/v1.
- Whether the credential is a TokenDance API key; never paste a real key, full Authorization header, or raw provider response.
- If the call comes from AgentHub, TokenDanceCode, CI, or automation, include the client type and a redacted task description.
Key management principles
- Every key should have a purpose, owner, quota, and rotation responsibility.
- Server apps use secret storage; local CLIs use local environment variables; CI uses controlled CI secrets.
- Frontend pages, browser sessionStorage/localStorage, public repositories, public issues, and screenshots must not contain real keys.
- If leakage is suspected, rotate the key first, then clean logs and screenshots. Do not only delete the public page.
Getting access
The public site does not issue real API keys. TokenDance API keys should come from a controlled issuance flow and be registered by team, purpose, and quota. TokenDance ID login proves a human or organization identity; it is not the same as model API credentials.
In progress
- Public models, rate limits, common errors, and SDK examples.
- API key issuance, rotation, quota, usage lookup, and team ownership docs.
- Status vocabulary, admin entry, and TokenDance ID login boundary.
- Recommended configuration for AgentHub, Codex, Claude Code, and other agent workloads.