Instructions to use tencent/Hy4-preview with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use tencent/Hy4-preview with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="tencent/Hy4-preview") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("tencent/Hy4-preview") model = AutoModelForCausalLM.from_pretrained("tencent/Hy4-preview", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Inference
- HuggingChat
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use tencent/Hy4-preview with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "tencent/Hy4-preview" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "tencent/Hy4-preview", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/tencent/Hy4-preview
- SGLang
How to use tencent/Hy4-preview with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "tencent/Hy4-preview" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "tencent/Hy4-preview", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "tencent/Hy4-preview" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "tencent/Hy4-preview", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use tencent/Hy4-preview with Docker Model Runner:
docker model run hf.co/tencent/Hy4-preview
Add LHTB 2.0 (Long-Horizon Terminal-Bench) eval result: 15/77 tasks solved
Adds the Long-Horizon Terminal-Bench 2.0 (LHTB 2.0) result for Hunyuan hy4 so it appears on the LHTB benchmark leaderboard under the lhtb2_solved task.
Score: 15 / 77 tasks solved at reward >= 0.95 (pass@0.95)
| Metric | Value |
|---|---|
| Solved (reward >= 0.95) | 15 / 77 |
| Strict pass (reward = 1.0) | 14 / 77 |
| Mean reward (77 tasks) | 0.532 |
| Agent | terminus-2 (official LHTB Harbor harness) |
| Budget | 3 hours per task, 1 trial per task |
LHTB measures how well agents sustain useful work in a containerized terminal
over hundreds of steps, graded by hidden rebuild-from-artifact verifiers. LHTB 2.0
has 77 tasks: the original 46 plus 31 new ones, 30 of them reconstruction tasks.
Full results, with per-task rewards and trajectories linked from there:
https://github.com/zli12321/LHTB/tree/lhtb-2.0#lhtb-20-results-october-2026
Submitted by the LHTB maintainers; happy to adjust the formatting or withdraw if you prefer.