Call models and check usage
Choose a protocol, authenticate, stream responses, interpret usage, and handle common TokenHub errors.
This guide explains how to choose a TokenHub protocol, authenticate a request, control output, and confirm usage. Exact field schemas are maintained in the TokenHub API reference.
Base URL and authentication
All TokenHub API operations use https://router.chbcloud.com and a Bearer API key.
Authorization: Bearer <API_KEY>
Content-Type: application/jsonUse the exact endpoint for the selected protocol. For OpenAI-compatible SDKs, set the base URL to https://router.chbcloud.com/v1. For Anthropic-compatible tools, set the base URL to https://router.chbcloud.com.
Choose a protocol
- Call
GET /v1/models. - Copy the model ID exactly.
- Use the protocol recommended for that model:
- Claude: Anthropic Messages.
- Gemini: Gemini native.
- GPT-series Responses clients: OpenAI Responses.
- General OpenAI-compatible applications: OpenAI Chat Completions.
- Send one low-cost request before changing production traffic.
Last updated on