TokenRouter
Unified, OpenAI-compatible gateway aggregating many AI models.
Overview
TokenRouter is a unified API gateway that aggregates models from many upstream providers behind a single OpenAI-compatible interface.
Official Website: https://www.tokenrouter.com API Documentation: https://www.tokenrouter.com/docs
Key features
- Unified gateway — Broad model selection from one endpoint
- OpenAI-compatible — Standard
/chat/completionsinterface - Multi-provider routing — Route requests across upstream providers
- Unified access — One endpoint across all upstream providers
Using TokenRouter with Yunxin
Address TokenRouter models using the provider/model convention by prefixing with tokenrouter/. Like OpenRouter, TokenRouter model ids may themselves be namespaced; Yunxin passes the nested suffix upstream (for example, tokenrouter/openai/gpt-4o). Requests use the same Yunxin base URL (https://api.yuhuanstudio.com/v1) and your Yunxin sk- API key.
Usage example
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["YUNXIN_API_KEY"],
base_url="https://api.yuhuanstudio.com/v1"
)
response = client.chat.completions.create(
model="tokenrouter/openai/gpt-4o",
messages=[{"role": "user", "content": "Hello!"}]
)
print(response.choices[0].message.content)Available models
Query the live catalog with the Models API:
curl "https://api.yuhuanstudio.com/v1/models?provider=tokenrouter" \
-H "Authorization: Bearer $YUNXIN_API_KEY"Capabilities and pricing are tracked per model. Use GET /v1/models?provider=tokenrouter and each model's capabilities array as the authoritative source rather than relying on a hardcoded list.
Official resources
How is this guide?