Hy4 API — Pricing, Access & Documentation

How to call Tencent Hy4 Preview through an OpenAI-compatible endpoint. Model ID, pricing, context limits, and copy-paste code examples for curl, Python, and Node.js. Last updated: August 28, 2026.

Quick Start: Three Things You Need

ItemValue
Model IDtencent/hy4-preview
Endpoint (OpenAI-compatible)https://tokenra.io/v1/chat/completions
API keyGenerate free at tokenra.io/register

Hy4 Preview is served as a hosted API and is OpenAI-compatible. If you have existing OpenAI SDK code, you only need to change the base_url and model fields.

Get Your Free API Key →

Code Examples

cURL

curl https://tokenra.io/v1/chat/completions \
  -H "Authorization: Bearer $TOKENRA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "tencent/hy4-preview",
    "messages": [
      {"role": "user", "content": "Explain the difference between MoE and dense models."}
    ]
  }'

Python (OpenAI SDK)

from openai import OpenAI

client = OpenAI(
    base_url="https://tokenra.io/v1",
    api_key="YOUR_TOKENRA_API_KEY",
)

response = client.chat.completions.create(
    model="tencent/hy4-preview",
    messages=[
        {"role": "user", "content": "Explain the difference between MoE and dense models."}
    ],
)

print(response.choices[0].message.content)

Node.js (OpenAI SDK)

import OpenAI from 'openai';

const client = new OpenAI({
  baseURL: 'https://tokenra.io/v1',
  apiKey: 'YOUR_TOKENRA_API_KEY',
});

const completion = await client.chat.completions.create({
  model: 'tencent/hy4-preview',
  messages: [{ role: 'user', content: 'Hello, Hy4!' }],
});

console.log(completion.choices[0].message.content);
Security: store API keys in server-side environment variables. Never commit a real key to source control or expose it in browser-side code.

Hy4 API Pricing (per 1M tokens)

PriceBilling
Input tokens$0.834Flat rate — no peak/off-peak
Output tokens$2.501

Hy4 Preview uses a single flat rate, unlike DeepSeek's peak/off-peak model. For a full price breakdown against other flagship models, see our Hy4 vs DeepSeek comparison.

Note: Hy4 is currently in grey-testing. Prices and limits may change at official release. These figures are from the current public listing and should be verified before deployment.

Model Specifications

SpecificationValue
Context window1,048,576 tokens
Maximum output64,000 tokens
ArchitectureMoE — 770B total / 49B active
Backbone78 layers (1 dense FFN + 77 MoE)
Experts per MoE layer256 routed + 1 shared
MTP layer1 native (10B / 0.7B active), speculative decoding

Full architecture details are available on the Hy4 Preview home page.

Frequently Asked Questions

How do I access the Hy4 API?

Hy4 Preview is available through OpenAI-compatible API gateways. Create a free account at tokenra.io/register, generate an API key, and call the model ID tencent/hy4-preview against https://tokenra.io/v1/chat/completions.

How much does the Hy4 API cost?

Hy4 Preview is priced at $0.834 per 1M input tokens and $2.501 per 1M output tokens on OpenRouter, with a flat rate and no peak/off-peak pricing.

What is the Hy4 API model ID?

The model ID is tencent/hy4-preview on OpenRouter and OpenAI-compatible gateways.

Is the Hy4 API OpenAI-compatible?

Yes. Hy4 Preview is served through OpenAI-compatible endpoints, so existing OpenAI SDK code works by changing only the base URL and model ID.

What is the Hy4 API context window?

Hy4 Preview supports a 1,048,576 token context window with a maximum output of 64,000 tokens.