import requests r = requests.post( "https://api.aimlapi.com/v1/chat/completions", headers={"Authorization": "Bearer " + AIMLAPI_KEY}, json={ "model": "tencent/hy4-preview", "messages": [ { "role": "user", "content": "Hello!" } ] }, ) print(r.json())
const r = await fetch("https://api.aimlapi.com/v1/chat/completions", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.AIMLAPI_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"model": "tencent/hy4-preview",
"messages": [
{
"role": "user",
"content": "Hello!"
}
]
}),
});
console.log(await r.json());
curl -X POST https://api.aimlapi.com/v1/chat/completions \ -H "Authorization: Bearer $AIMLAPI_KEY" \ -H "Content-Type: application/json" \ -d '{"model":"tencent/hy4-preview","messages":[{"role":"user","content":"Hello!"}]}'
OpenAI-compatible — swap the base URL and it works with your existing SDK.
| Type | Price |
|---|---|
| Input | |
| Output | |
| Cached input |
| Model | Input | Output | Context | Best for |
|---|---|---|---|---|
Hy4 Preview This page | Long-horizon coding + agentic works | |||
| Reasoning + agents | ||||
| Long-context, multimodal & agentic workflows | ||||
| Reasoning + agents |
Hy4 Preview has a 1,048,576 tokens context window and can return up to 64,000 tokens.
Hy4 Preview takes text as input and returns text.
Use tencent/hy4-preview as the model id. Requests go to https://api.aimlapi.com/v1/chat/completions.
Hy4 Preview became available on August 28, 2026.
Hy4 Preview is priced at input $1.1470836 / 1M tokens, output $3.4398754 / 1M tokens, cached input $0.0577668 / 1M tokens.
Yes, Hy4 Preview can stream responses as they are generated.
Hy4 Preview was built by Tencent.
Yes, Hy4 Preview supports function calling, allowing it to invoke external tools during a conversation.
Hy4 Preview is a mixture-of-experts model with 49B active parameters out of 770B total.