How to hit the Tencent Hunyuan (TokenHub) API

Tencent Cloud serves the Hunyuan models internationally through TokenHub, an OpenAI-compatible API: https://tokenhub-intl.tencentcloudmaas.com/v1 (Singapore) or https://tokenhub-us.tencentcloudmaas.com/v1 (Silicon Valley).

Authentication

Create a TokenHub API key in the Tencent Cloud console and send it as Authorization: Bearer <key>. In the examples it's written {{TENCENT_TOKENHUB_KEY}}. Check which models your region offers with the models call.

Full reference: https://www.tencentcloud.com/techpedia/148044?lang=en

Chat with Hy4 Preview

curl https://tokenhub-intl.tencentcloudmaas.com/v1/chat/completions \
  -H "Authorization: Bearer {{TENCENT_TOKENHUB_KEY}}" \
  -H "Content-Type: application/json" \
  -d '{"model": "hy4-preview", "messages": [{"role": "user", "content": "Explain what an API rate limit is in two sentences."}]}'
Run in PostTaco

Models in your region

curl https://tokenhub-intl.tencentcloudmaas.com/v1/models \
  -H "Authorization: Bearer {{TENCENT_TOKENHUB_KEY}}"
Run in PostTaco