Hy4 API — Pricing, Model ID & Free API Key

How to call Tencent Hy4 (official release) through an OpenAI-compatible endpoint. Model ID, pricing, context limits, and copy-paste code examples for curl, Python, and Node.js. Last updated: November 4, 2026.

Quick Start: Three Things You Need

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

Hy4 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 →

For a minimal working chat loop and prompt patterns suited to Hy4's 1M-token context, see the Hy4 chat guide.

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",
    "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",
    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',
  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)

ItemOpenRouter (Original)TokenRa (20% off)
Input /M$0.834$0.667
Output /M$2.501$2.001
Cache read /M$0.042$0.034

Hy4 official release uses a single flat rate, unlike DeepSeek's peak/off-peak model. TokenRa offers a 20% discount on the OpenRouter list price. For the full per-1M rate card, cache pricing and per-request cost examples, see the Hy4 pricing page; for how Hy4 compares with DeepSeek on architecture and benchmarks, see the Hy4 vs DeepSeek comparison.

Note: Hy4 was officially released on November 4, 2026. Pricing is stable at the listed rates. Always verify current prices with your gateway provider before production deployment.

Model Specifications

SpecificationValue
Context window1,048,576 tokens
Maximum output64,000 tokens
ArchitectureMoE — detailed specs not yet published (Hy4 Preview: 770B / 49B active, 78 layers)
Release dateNovember 4, 2026
Model IDtencent/hy4

Full architecture details are available on the Hy4 home page.

Frequently Asked Questions

How do I access the Hy4 API?

Hy4 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 against https://tokenra.io/v1/chat/completions.

How much does the Hy4 API cost?

Hy4 official release is priced at $0.834 per 1M input tokens and $2.501 per 1M output tokens on OpenRouter. On TokenRa, it's available at 20% off: $0.667 per 1M input and $2.001 per 1M output, with a flat rate and no peak/off-peak pricing.

What is the Hy4 API model ID?

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

Is the Hy4 API OpenAI-compatible?

Yes. Hy4 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 supports a 1,048,576 token context window with a maximum output of 64,000 tokens.