-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhy4-api.html
More file actions
233 lines (218 loc) · 14.6 KB
/
Copy pathhy4-api.html
File metadata and controls
233 lines (218 loc) · 14.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Hy4 API — Pricing, Access & Docs | Tencent Hy4 Preview</title>
<meta name="description" content="Hy4 API access and pricing: model ID tencent/hy4-preview, $0.834/1M input, $2.501/1M output, 1M context, and OpenAI-compatible code examples.">
<link rel="canonical" href="https://hy4ai.com/hy4-api.html">
<link rel="icon" href="/favicon.svg" type="image/svg+xml">
<meta property="og:title" content="Hy4 API — Pricing, Access & Documentation">
<meta property="og:description" content="Model ID tencent/hy4-preview, $0.834/1M input, 1M context, and OpenAI-compatible API examples.">
<meta property="og:url" content="https://hy4ai.com/hy4-api.html">
<meta property="og:type" content="article">
<meta property="og:image" content="https://hy4ai.com/og-image.png">
<meta name="twitter:card" content="summary_large_image">
<script type="application/ld+json">
{
"@context":"https://schema.org",
"@type":"FAQPage",
"mainEntity":[
{"@type":"Question","name":"How do I access the Hy4 API?","acceptedAnswer":{"@type":"Answer","text":"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 the endpoint https://tokenra.io/v1/chat/completions."}},
{"@type":"Question","name":"How much does the Hy4 API cost?","acceptedAnswer":{"@type":"Answer","text":"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 or off-peak pricing."}},
{"@type":"Question","name":"What is the Hy4 API model ID?","acceptedAnswer":{"@type":"Answer","text":"The model ID is tencent/hy4-preview on OpenRouter and OpenAI-compatible gateways."}},
{"@type":"Question","name":"Is the Hy4 API OpenAI-compatible?","acceptedAnswer":{"@type":"Answer","text":"Yes. Hy4 Preview is served through OpenAI-compatible endpoints, so existing OpenAI SDK code works by changing the base URL and model ID."}},
{"@type":"Question","name":"What is the Hy4 API context window?","acceptedAnswer":{"@type":"Answer","text":"Hy4 Preview supports a 1,048,576 token context window with a maximum output of 64,000 tokens."}}
]
}
</script>
<script type="application/ld+json">
{
"@context":"https://schema.org",
"@type":"Article",
"headline":"Hy4 API — Pricing, Access & Documentation",
"description":"How to access the Tencent Hy4 Preview API: model ID, OpenAI-compatible endpoints, pricing, and code examples.",
"datePublished":"2026-08-28",
"dateModified":"2026-08-28",
"author":{"@type":"Organization","name":"hy4ai.com"},
"publisher":{"@type":"Organization","name":"hy4ai.com"},
"mainEntityOfPage":{"@type":"WebPage","@id":"https://hy4ai.com/hy4-api.html"}
}
</script>
<script type="application/ld+json">
{
"@context":"https://schema.org",
"@type":"WebPage",
"name":"Hy4 API — Pricing, Access & Documentation",
"url":"https://hy4ai.com/hy4-api.html",
"breadcrumb":{"@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://hy4ai.com/"},{"@type":"ListItem","position":2,"name":"Hy4 API","item":"https://hy4ai.com/hy4-api.html"}]}
}
</script>
<style>
:root { --ink:#14213d; --muted:#65728c; --blue:#1769ff; --blue-deep:#0b4fd7; --line:#e4ebf7; --card:rgba(255,255,255,.88); }
* { box-sizing:border-box; }
html { scroll-behavior:smooth; }
body { font-family:"Avenir Next","Segoe UI",sans-serif; line-height:1.7; color:var(--ink); margin:0; background:#fff; font-size:15px; }
body::before { content:""; position:fixed; inset:0; pointer-events:none; opacity:.32; background-image:radial-gradient(#cddafa .7px,transparent .7px); background-size:22px 22px; mask-image:linear-gradient(to bottom,#000,transparent 40%); z-index:-1; }
.wrap { max-width:1180px; margin:0 auto; padding:0 34px; }
header { border-bottom:1px solid rgba(220,229,245,.75); padding:15px 0; background:rgba(255,255,255,.84); backdrop-filter:blur(14px); position:sticky; top:0; z-index:10; }
nav { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:14px; }
.logo { font-weight:800; letter-spacing:-.04em; font-size:20px; color:var(--ink); text-decoration:none; }
.logo::before { content:""; display:inline-block; width:6px; height:20px; background:var(--blue); border-radius:5px; vertical-align:-3px; margin-right:9px; }
nav .links { display:flex; align-items:center; gap:22px; }
nav .links a { color:#59667d; text-decoration:none; font-size:13px; font-weight:600; }
nav .links a:hover { color:var(--blue); }
nav .cta { background:var(--ink); color:#fff!important; padding:9px 15px; border-radius:7px; box-shadow:0 5px 14px rgba(20,33,61,.14); }
.hero { position:relative; overflow:hidden; padding:82px 0 72px; background:linear-gradient(112deg,#f7faff 0%,#edf4ff 53%,#fff 100%); }
.hero::after { content:"API"; position:absolute; right:9%; top:32px; font-size:clamp(150px,25vw,300px); line-height:1; font-weight:900; letter-spacing:-.12em; color:rgba(23,105,255,.055); transform:rotate(-8deg); pointer-events:none; }
.hero .wrap { position:relative; z-index:1; }
h1 { max-width:820px; font-size:clamp(38px,5vw,60px); line-height:1.08; letter-spacing:-.055em; margin:0 0 22px; }
h1::first-line { color:var(--blue); }
.sub { font-size:17px; color:#526079; max-width:820px; margin:0; }
section { padding:66px 0; border-top:1px solid var(--line); }
section:nth-of-type(even) { background:rgba(247,250,255,.72); }
h2 { font-size:25px; line-height:1.2; letter-spacing:-.035em; margin:0 0 18px; display:flex; align-items:center; gap:12px; }
h2::before { content:""; width:4px; height:25px; border-radius:4px; background:var(--blue); flex:0 0 auto; }
h3 { font-size:18px; color:var(--ink); margin:26px 0 8px; }
p { color:#5d6b83; }
table { width:100%; border-collapse:separate; border-spacing:0; font-size:13px; margin-top:24px; overflow:hidden; border:1px solid var(--line); border-radius:10px; background:var(--card); box-shadow:0 12px 35px rgba(37,78,145,.06); }
th,td { border:0; border-bottom:1px solid var(--line); padding:13px 16px; text-align:left; }
tr:last-child td { border-bottom:0; }
th { background:#eef4ff; color:#33415e; font-size:12px; text-transform:uppercase; letter-spacing:.04em; }
td { color:#59667d; }
td:first-child { color:var(--ink); font-weight:600; }
code { background:#eaf1ff; color:#155bd5; padding:3px 7px; border-radius:4px; font-size:12px; }
pre { margin:18px 0 28px; padding:20px; overflow-x:auto; border:1px solid #d8e4fa; border-radius:11px; background:#122344; color:#e4edff; box-shadow:0 14px 35px rgba(16,48,102,.15); font:12px/1.8 Consolas,"SFMono-Regular",monospace; }
pre code { padding:0; background:transparent; color:inherit; font:inherit; }
.btn { display:inline-block; background:linear-gradient(135deg,#277bff,#0955df); color:#fff; padding:13px 22px; border-radius:8px; text-decoration:none; font-weight:700; font-size:14px; box-shadow:0 10px 22px rgba(23,105,255,.24); }
.note { background:#f1f6ff; border:1px solid #d6e4ff; border-radius:10px; padding:18px 20px; margin:20px 0; font-size:14px; color:#5d6b83; }
.faq-item { margin-bottom:14px; padding:20px 24px; border:1px solid var(--line); border-radius:10px; background:rgba(255,255,255,.86); box-shadow:0 8px 24px rgba(37,78,145,.045); }
.faq-item h3 { font-size:16px; margin:0 0 6px; }
.faq-item p { margin:0; font-size:14px; }
footer { border-top:1px solid var(--line); padding:30px 0; font-size:12px; color:#8994a8; background:#f6f9ff; }
footer p, footer a { color:#8994a8; }
@media (max-width:700px) { .wrap{padding:0 20px;} header{position:static;} nav .links{width:100%;justify-content:space-between;gap:9px;} nav .links a{font-size:11px;} nav .cta{padding:7px 9px;} .hero{padding:58px 0 52px;} section{padding:46px 0;} table{display:block;overflow-x:auto;white-space:nowrap;} pre{font-size:11px;padding:16px;} }
</style>
</head>
<body>
<header>
<div class="wrap">
<nav>
<a class="logo" href="/">Hy4 Preview</a>
<div class="links">
<a href="/hy4-api.html">API</a>
<a href="/hy4-benchmarks.html">Benchmarks</a>
<a href="/hy4-vs-deepseek.html">Compare</a>
<a href="/about.html">About</a>
<a class="cta" href="https://tokenra.io/sign-up" target="_blank" rel="noopener">Get API Access →</a>
</div>
</nav>
</div>
</header>
<div class="hero">
<div class="wrap">
<h1>Hy4 API — Pricing, Access & Documentation</h1>
<p class="sub">How to call <strong>Tencent Hy4 Preview</strong> 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.</p>
</div>
</div>
<main>
<section>
<div class="wrap">
<h2>Quick Start: Three Things You Need</h2>
<table>
<tr><th>Item</th><th>Value</th></tr>
<tr><td>Model ID</td><td><code>tencent/hy4-preview</code></td></tr>
<tr><td>Endpoint (OpenAI-compatible)</td><td><code>https://tokenra.io/v1/chat/completions</code></td></tr>
<tr><td>API key</td><td>Generate free at <a href="https://tokenra.io/register" target="_blank" rel="noopener">tokenra.io/register</a></td></tr>
</table>
<p>Hy4 Preview is served as a hosted API and is <strong>OpenAI-compatible</strong>. If you have existing OpenAI SDK code, you only need to change the <code>base_url</code> and <code>model</code> fields.</p>
<p><a class="btn" href="https://tokenra.io/register" target="_blank" rel="noopener">Get Your Free API Key →</a></p>
</div>
</section>
<section>
<div class="wrap">
<h2>Code Examples</h2>
<h3>cURL</h3>
<pre><code>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."}
]
}'</code></pre>
<h3>Python (OpenAI SDK)</h3>
<pre><code>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)</code></pre>
<h3>Node.js (OpenAI SDK)</h3>
<pre><code>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);</code></pre>
<div class="note"><strong>Security:</strong> store API keys in server-side environment variables. Never commit a real key to source control or expose it in browser-side code.</div>
</div>
</section>
<section>
<div class="wrap">
<h2>Hy4 API Pricing (per 1M tokens)</h2>
<table>
<tr><th></th><th>Price</th><th>Billing</th></tr>
<tr><td>Input tokens</td><td>$0.834</td><td rowspan="2">Flat rate — no peak/off-peak</td></tr>
<tr><td>Output tokens</td><td>$2.501</td></tr>
</table>
<p>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 <a href="/hy4-vs-deepseek.html">Hy4 vs DeepSeek comparison</a>.</p>
<div class="note"><strong>Note:</strong> 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.</div>
</div>
</section>
<section>
<div class="wrap">
<h2>Model Specifications</h2>
<table>
<tr><th>Specification</th><th>Value</th></tr>
<tr><td>Context window</td><td>1,048,576 tokens</td></tr>
<tr><td>Maximum output</td><td>64,000 tokens</td></tr>
<tr><td>Architecture</td><td>MoE — 770B total / 49B active</td></tr>
<tr><td>Backbone</td><td>78 layers (1 dense FFN + 77 MoE)</td></tr>
<tr><td>Experts per MoE layer</td><td>256 routed + 1 shared</td></tr>
<tr><td>MTP layer</td><td>1 native (10B / 0.7B active), speculative decoding</td></tr>
</table>
<p>Full architecture details are available on the <a href="/">Hy4 Preview home page</a>.</p>
</div>
</section>
<section>
<div class="wrap">
<h2>Frequently Asked Questions</h2>
<div class="faq-item"><h3>How do I access the Hy4 API?</h3><p>Hy4 Preview is available through OpenAI-compatible API gateways. Create a free account at <a href="https://tokenra.io/register" target="_blank" rel="noopener">tokenra.io/register</a>, generate an API key, and call the model ID <code>tencent/hy4-preview</code> against <code>https://tokenra.io/v1/chat/completions</code>.</p></div>
<div class="faq-item"><h3>How much does the Hy4 API cost?</h3><p>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.</p></div>
<div class="faq-item"><h3>What is the Hy4 API model ID?</h3><p>The model ID is <code>tencent/hy4-preview</code> on OpenRouter and OpenAI-compatible gateways.</p></div>
<div class="faq-item"><h3>Is the Hy4 API OpenAI-compatible?</h3><p>Yes. Hy4 Preview is served through OpenAI-compatible endpoints, so existing OpenAI SDK code works by changing only the base URL and model ID.</p></div>
<div class="faq-item"><h3>What is the Hy4 API context window?</h3><p>Hy4 Preview supports a 1,048,576 token context window with a maximum output of 64,000 tokens.</p></div>
</div>
</section>
</main>
<footer>
<div class="wrap">
<p><a href="/">← Back to Hy4 Preview home</a> · <a href="/hy4-vs-deepseek.html">Hy4 vs DeepSeek</a> · <a href="/hy4-api.html">API docs</a></p>
<p>© 2026 hy4ai.com · <a href="/about.html">About</a> ·</p>
<p>hy4ai.com is an independent third-party site and is not affiliated with, endorsed by, or connected to Tencent or TokenRa. Specifications and prices are sourced from public listings and may change without notice. Last updated: August 28, 2026.</p>
</div>
</footer>
</body>
</html>