
LiteLLM supports Tencent Hy4 through Tencent Cloud TokenHub. Use the same OpenAI-compatible request format as your other models, with spend tracking, rate limits and logs in the LiteLLM AI Gateway.
Tencent Hy4 pricing
Current prices include TokenHub's 50% discount, available through December 31, 2026, at 23:59:59 Beijing time. Prices are in USD per 1M tokens, from TokenHub's international pricing page.
| Token type | Current price | List price |
|---|---|---|
| Input | $0.417 | $0.834 |
| Output | $1.2505 | $2.501 |
| Cached input | $0.021 | $0.042 |
Hy4 preview has the same prices. TokenHub resumes billing at list prices after the promotion ends.
What's new in Hy4
Hy4 adds image understanding to the preview model's reasoning, function calling and structured output. Tencent reports improvements on long-running agent tasks and introduces computer-use capabilities.
TokenHub lists a 1M-token context window, with up to 960,000 input tokens and 64,000 output tokens. Use hy4 for this release; hy4-preview remains a separate model ID.
Use Tencent Hy4 with LiteLLM
Create a TokenHub API key using Tencent's quickstart, then export it in your terminal:
export TENCENT_API_KEY="YOUR_TENCENT_API_KEY"
- LiteLLM Proxy
- LiteLLM Python SDK
1. Save this as config.yaml
model_list:
- model_name: hy4
litellm_params:
model: tencent/hy4
api_key: os.environ/TENCENT_API_KEY
general_settings:
master_key: os.environ/LITELLM_MASTER_KEY
2. Start the proxy
Generate a local proxy key and start the v1.108.5 image:
export LITELLM_MASTER_KEY="sk-$(openssl rand -hex 24)"
docker run -d --name litellm-hy4 \
-p 127.0.0.1:4000:4000 \
-e TENCENT_API_KEY \
-e LITELLM_MASTER_KEY \
-v "$(pwd)/config.yaml:/app/config.yaml:ro" \
ghcr.io/berriai/litellm:v1.108.5 \
--config /app/config.yaml
3. Test it
Once the proxy is ready, run this in the same terminal:
curl --fail-with-body http://localhost:4000/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $LITELLM_MASTER_KEY" \
-d '{
"model": "hy4",
"messages": [{"role": "user", "content": "Write a Python function that checks whether a number is prime."}]
}'
The response contains the generated answer in choices[0].message.content.
Install LiteLLM, then run the Python example with TENCENT_API_KEY set:
pip install --upgrade litellm
from litellm import completion
response = completion(
model="tencent/hy4",
messages=[
{"role": "user", "content": "Write a Python function that checks whether a number is prime."}
],
)
print(response.choices[0].message.content)
For an existing proxy, add the model entry to your configuration and restart the proxy. To refresh its pricing, open Models + Endpoints → Price Data → Reload Price Data, or call POST /reload/model_cost_map as an admin. Keep the default remote cost map enabled: the pinned image's bundled map predates the Hy4 entry.
FAQ
Which provider prefix and API key do I use?
Use tencent/hy4 with TENCENT_API_KEY. LiteLLM defaults to TokenHub's international endpoint. See the Tencent provider guide for region overrides.
Does Hy4 accept images?
Yes. Send text and image_url content parts in your messages. The final Hy4 release adds vision; Hy4 preview is text-only.
Feedback
Questions about Hy4 on LiteLLM? Share your use case or report a problem in GitHub Discussions.

