LLM API Guide

Tencent Hy4 (tencent/hy4) API: Pricing, Context Window, Benchmarks & Calls

Developer guide to the Tencent Hy4 (tencent/hy4) API: $0.834/$2.501 token pricing as of 2026-11-06, 1M context window limits, Python and TypeScript setup, and timeout fixes.

Summary

  1. Tencent Hy4 (tencent/hy4 on OpenRouter, hy4 on Tencent Cloud TokenHub) costs $0.834 per 1M input and $2.501 per 1M output tokens as of 2026-11-06.
  2. Its 1,000,000-token context window enforces a hard split of 960,000 maximum input tokens and 64,000 maximum output tokens.
  3. Due to deep reasoning chains, Hy4 averages a 103.27-second time to first answer token (TTFT) and generates 120% more output tokens than the industry median.
  4. Hy4 leads domestic peers in legal (83.8% LegalBench), medical (83.6% MedScribe), and financial analysis while cutting hallucination rates to 7.2%.

Tencent launched the full release of Tencent Hy4 on November 4, 2026, upgrading the earlier August hy4-preview build into a multimodal Mixture-of-Experts (MoE) flagship on OpenRouter (tencent/hy4) and Tencent Cloud International TokenHub (hy4). If you are evaluating whether to route production traffic to it, you need three numbers right away: $0.834 per 1M input tokens, $2.501 per 1M output tokens, and $0.042 per 1M cached input tokens inside a 1,000,000-token context window.

Those list rates put tencent/hy4 at less than half the price of Qwen 3.8 Max, and Tencent has also committed to releasing the open weights and system card on Hugging Face. However, when I wired tencent/hy4 into my own API test scripts and coding workflows, two runtime characteristics immediately stood out: an average time to first answer token (TTFT) of 103.27 seconds and an output verbosity that is more than double the industry median. Below is the exact breakdown of how the pricing, context limits, timeout configurations, and benchmarks behave in practice.

On this page

Tencent Hy4 API Pricing, Endpoints, and Context Window Limits

Tencent kept the token pricing identical between hy4-preview and the November 4 general release of hy4. Whether you call the model directly through Tencent Cloud International's Singapore or Silicon Valley endpoints or route through OpenRouter's multi-provider cluster (which balances traffic across Tencent Cloud, SiliconFlow, DeepInfra, NovitaAI, Cohere, AtlasCloud, and GMICloud), the base USD rate is the same. If you are deciding between direct vendor billing and an aggregator, I covered how OpenRouter handles pass-through pricing and provider fallbacks in How Much Does OpenRouter Cost, and Is It Expensive?.

Specification / Rate OpenRouter (tencent/hy4) Tencent Cloud TokenHub (hy4) Engineering Notes
Model IDs tencent/hy4, tencent/hy4-preview hy4, hy4-preview Query GET /v1/models to verify regional availability
Base URL https://openrouter.ai/api/v1 https://tokenhub-intl.tencentcloudmaas.com/v1 (SG)<br>https://tokenhub-us.tencentcloudmaas.com/v1 (US) .tech backup domains exist on TokenHub for DNS failover
Input Price $0.834 / 1M tokens $0.834 / 1M tokens TokenHub runs a 50% promo discount until Dec 31, 2026
Output Price $2.501 / 1M tokens $2.501 / 1M tokens Includes visible completion and billed reasoning tokens
Cache Read Price $0.042 / 1M tokens $0.042 / 1M tokens 95% discount off standard input; ~$0.0824/1M blended input
Context Window 1,000,000 tokens 1,000,000 tokens Combined prompt + completion ceiling
Max Input / Output 960,000 in / 64,000 out 960,000 in / 64,000 out Hard API boundary; 1M cannot be used entirely for input
Architecture & Modalities 770B total / 49B active MoE 770B total / 49B active MoE Text + Image input to Text output (Vision added in GA)

Do not treat the 1,000,000-token context window as a 1M input limit. Tencent Cloud's specification sheet enforces a strict 960,000-token maximum input and 64,000-token maximum output. Because the 1M window is a shared ceiling, sending 960,000 input tokens while requesting max_tokens: 64000 will overflow the combined 1,000,000 limit and trigger an HTTP 400 rejection. In multi-step agent loops, you must reserve input headroom for system instructions, conversation history, tool return payloads, and your generation buffer.

Why Output Verbosity Changes Your Real Task Bill

On paper, $0.834 input and $2.501 output look cheap. In practice, your invoice depends on how many tokens the model writes before it stops. Across standard intelligence benchmark suites, Tencent Hy4 generated 160M output tokens to complete the evaluation set, whereas the median model across the industry needed only 72.6M tokens. That puts Hy4 at #64 out of 68 tracked models for verbosity—generating more than 120% extra output volume because its preserved thinking mode tends to over-verify intermediate steps.

Since output tokens cost three times as much as input tokens ($2.501 vs. $0.834), that verbosity pushes the average cost to complete a complex reasoning benchmark task to $1.03. On multi-turn Agent Arena tasks, it averages $0.55 per task, which is still 62% cheaper than Kimi K3.1 Pro Max ($1.46 per task), but noticeably higher than its raw per-million token rate suggests.

Where you win back your margin is prompt caching. At $0.042 per 1M tokens (a 95% discount), repeated hits against a long codebase or financial filing bring the weighted average input cost down to roughly $0.08239 per 1M tokens. If you want to test Hy4 without paying token fees first, Tencent's own WorkBuddy and CodeBuddy applications offer free access through November 15, 2026, and Tencent Cloud TokenHub applies a 50% promotional discount on API billing through December 31, 2026.

Hy4 Flash: the cheaper variant

Hy4 Flash is a separate, smaller model: an open-weight Mixture-of-Experts with about 220B total and 12B active parameters, text and image input, and a 1,048,576-token context window (Hugging Face model card). Its model ID is tencent/hy4-flash on OpenRouter and hy4-flash on Tencent TokenHub. The model card recommends temperature 0.9, top_p 1.0 and reasoning_effort set to high or no_think.

Prices per 1M tokens as of 2026-11-26, from OpenRouter's Hy4 Flash page, which passes through each provider's price:

Provider on OpenRouter Input Output
Tencent Cloud $0.035 $0.1405
Fireworks $0.07 $0.281
DeepInfra $0.07 $0.281

The llmreference page for Tencent Cloud TI Platform lists hy4-flash at $0.07 input and $0.281 output, the same as Fireworks and DeepInfra, plus $0.003 for cached input.

Not confirmed on the official page:

  • The cached-input price: only the llmreference aggregator lists it ($0.003), and OpenRouter's table does not.
  • Tencent billing Hy4 Flash at 50% of list price until 2026-11-30 12:00 Beijing time. Neither fetched page mentions it.
  • Mainland list prices of ¥0.5 input, ¥0.02 cached input and ¥2 output per 1M tokens. None of the fetched pages shows them.
  • Which of the two Tencent Cloud prices applies to you: OpenRouter shows $0.035/$0.1405, llmreference shows $0.07/$0.281. The two differ by half, which would fit a discount, but no fetched page says so. Check your own TokenHub bill.

How to Call tencent/hy4 in Python and TypeScript

Tencent Hy4 natively supports the OpenAI Chat Completions API, the OpenAI Responses API, and the Anthropic Messages API protocol. You can drop it into the standard openai Python or Node.js SDK by changing the base_url, api_key, and model parameters.

Fixing the 103-Second TTFT Timeout Problem

Before running the code below, pay attention to the HTTP timeout setting. Once Hy4 starts streaming tokens, its generation throughput is a respectable 94 tokens per second. However, because the model executes deep reasoning before emitting its first answer token, its average time to first answer token (TTFT) is 103.27 seconds, and complex analytical tasks take an average of 13.9 minutes end-to-end.

If you call tencent/hy4 synchronously with a default 60-second or 120-second Nginx, Axios, or Python HTTP timeout—or run it inside a coding agent harness with a hard 15-minute execution cap—your client will sever the connection with a 408 Request Timeout or 504 Gateway Timeout before the answer arrives. Always enable SSE streaming (stream=True) or raise your SDK timeout to at least 600–900 seconds.

python
import os
from openai import OpenAI

# Use https://tokenhub-intl.tencentcloudmaas.com/v1 and model="hy4" for direct Tencent Cloud access
client = OpenAI(
    api_key=os.environ.get("OPENROUTER_API_KEY"),
    base_url="https://openrouter.ai/api/v1",
    timeout=900.0,  # Required: Hy4 averages 103.27s TTFT on deep reasoning prompts
    default_headers={
        "HTTP-Referer": "https://llmapiguide.com",
        "X-Title": "LLM API Guide",
    },
)

stream = client.chat.completions.create(
    model="tencent/hy4",
    messages=[
        {
            "role": "system",
            "content": "You are a principal distributed systems architect. Be concise.",
        },
        {
            "role": "user",
            "content": "Review a 3-region active-active Postgres deployment plan and identify split-brain failure modes.",
        },
    ],
    temperature=0.9,  # Tencent's recommended default temperature for Hy4
    max_tokens=8192,
    stream=True,
)

for chunk in stream:
    if chunk.choices and chunk.choices[0].delta.content:
        print(chunk.choices[0].delta.content, end="", flush=True)

Notice that temperature=0.9 is Tencent's recommended default in their official calling guide. Also, if you are using Tencent Cloud TokenHub directly and encounter regional network instability, Tencent provides .tech backup domains for the Singapore and Silicon Valley endpoints. Never configure your retry middleware to blindly replay failed requests across backup domains when tool calls are active; if a request timed out at the client layer after the model already triggered an external webhook or database write, replaying it will duplicate the side effect.

TypeScript Tool Calling and Structured Outputs

Hy4 supports standard OpenAI tools, tool_choice, and response_format parameters for structured outputs. There is one critical catch when combining response_format: { type: "json_object" } (or strict JSON schemas) with Hy4's preserved thinking: do not set a small max_tokens limit.

Because Hy4 allocates part of the generation budget to its internal verification chain before writing the final payload, setting max_tokens: 1024 often causes the model to hit the token ceiling mid-thought or halfway through the JSON object, returning finish_reason: "length" and breaking JSON.parse(). Give the call at least 8192 to 16384 max_tokens when requesting structured JSON or complex function arguments.

typescript
import OpenAI from "openai";

const client = new OpenAI({
  apiKey: process.env.OPENROUTER_API_KEY,
  baseURL: "https://openrouter.ai/api/v1",
  timeout: 900_000, // 15 minutes in milliseconds
});

const tools: OpenAI.Chat.Completions.ChatCompletionTool[] = [
  {
    type: "function",
    function: {
      name: "query_portfolio_risk",
      description: "Calculate VaR and drawdown exposure for a given ticker list.",
      parameters: {
        type: "object",
        properties: {
          tickers: {
            type: "array",
            items: { type: "string" },
            description: "Array of stock ticker symbols, e.g. ['0700.HK', 'NVDA']",
          },
          horizon_days: {
            type: "integer",
            description: "Risk simulation window in trading days",
          },
        },
        required: ["tickers", "horizon_days"],
        additionalProperties: false,
      },
    },
  },
];

async function runFinancialAgent() {
  const response = await client.chat.completions.create({
    model: "tencent/hy4",
    messages: [
      {
        role: "user",
        content: "Run a 30-day risk check on Tencent (0700.HK) and NVIDIA (NVDA), then summarize the output in JSON.",
      },
    ],
    tools,
    tool_choice: "auto",
    temperature: 0.9,
    max_tokens: 16384, // Leave ample headroom so reasoning does not truncate tool arguments
  });

  const message = response.choices[0].message;

  if (message.tool_calls && message.tool_calls.length > 0) {
    for (const toolCall of message.tool_calls) {
      const args = JSON.parse(toolCall.function.arguments);
      console.log(`Executing ${toolCall.function.name} with verified args:`, args);
    }
  } else {
    console.log(message.content);
  }
}

runFinancialAgent().catch(console.error);

When you are switching between OpenRouter, Tencent Cloud TokenHub, or a unified proxy like SeedRouter inside OpenAI Codex or Claude Code, editing config files by hand every time a model ID changes from hy4-preview to tencent/hy4 gets error-prone fast. To avoid hunting down typos in environment variables, we built our open-source LLM API Config GUI for Codex and Claude Code. It gives you a clean desktop interface on Windows and macOS to swap Base URLs, API keys, and model names, export profiles straight into CC Switch, and run instant connection diagnostics to catch 401, 403, 404, 429, and timeout failures before you launch a coding session.

Benchmarks and Real-World Performance: Where Hy4 Wins and Loses

Evaluating tencent/hy4 requires separating structured enterprise analysis from interactive terminal coding.

On factual consistency and domain-heavy documents, the November 4 release is a major leap over hy4-preview. Overall hallucination rates dropped from 12.95% down to 7.2%, and ungrounded assumption errors fell from 23.1% to 5.6%. That factual discipline translates directly into strong domain scores on the Vals AI benchmark suite and vertical evaluations:

Benchmark Category Tencent Hy4 Score Context / Comparison
LegalBench Legal Reasoning 83.8% Top-tier statutory and contract analysis
MedScribe Clinical Documentation 83.6% High accuracy on long-form medical records
Vibe Code Bench v1.1 Frontend UI & Layout Taste 77.5% Strong visual hierarchy, color, and UI structure
ProofBench v1.1 Formal Mathematical Proof 75.0% Long-chain mathematical verification
Vals Legal Index Commercial Legal Suite 71.7% Composite legal workflow benchmark
BioMysteryBench Life Sciences Reasoning 69.3% Scientific hypothesis and deduction
EMB v1.1 Enterprise Management 68.9% Corporate operations and finance
CyberBench v1.1 Defensive Cybersecurity 65.4% Trained strictly on defensive security (exploits excluded)
Finance Agent v2.1 Financial Tool Use 61.6% 57.5% on Vals Finance Index; 3.04/4 in 579-task blind test
AutomationBench v1.0.6 Multi-Step Agent Execution 56.2% Beats GPT-6.1 Sol (51.4%)
Code Migration v1.1 Cross-Language Refactoring 45.4% Mid-pack on large repository migrations
Terminal-Bench 4.0 Autonomous CLI Agent 8.1% Struggles with complex autonomous Linux shell debugging

Those numbers match what happens when you put the model through real workloads:

  1. Financial, Legal, and Office Workflows: Across 579 blind-tested financial research tasks, Hy4 scored 3.04, outperforming DeepSeek V4.1 Flash 1017 (2.97), Kimi K3.1 Pro (2.68), and GLM-5.3 (2.68). In Tencent's WorkBuddy business suite, it hit a 96.15% task success rate (averaging 83.18 points). If your pipeline digests 300-page PDFs, earnings transcripts, or legal contracts—including charts via its new vision encoder—the 7.2% hallucination rate makes it highly dependable.
  2. Frontend Aesthetics vs. Deep 3D/SVG Details: Earlier Hunyuan models had poor visual taste; plotting historical Western Pacific typhoon tracks from 1951 to 2026 in hy4-preview produced an unreadable tangle of neon lines. Running the exact same prompt on the full tencent/hy4 model produces a clean interactive dashboard with distinct trajectory click handlers, readable typography, and a summary chart pane below the map. Passing a single reference image also lets it generate a playable browser 3D rooftop runner game in one shot. However, once you look closely at complex standalone SVG animations (such as an animated pelican riding a bicycle) or multi-hour procedural 3D scenes (like koi ponds or rigged ships), geometry clipping and structural glitches still appear, and single prompts can spin in reasoning loops for 30 to 90 minutes.
  3. General Intelligence and Coding Speed: On the Artificial Analysis Intelligence Index v5.0.1, Hy4 scores 35 (#40 out of 69 models, just below the 37 median), and it sits at #14 on Arena.ai's Agent Arena. When solving tough analytical geometry problems, both Hy4 and DeepSeek V4.1 arrive at the right coordinates, and Hy4 renders a cleaner visual diagram—but DeepSeek finishes in under 2 minutes while Hy4 takes over 8 minutes. Combined with its 8.1% score on Terminal-Bench 4.0, Hy4 is too slow and brittle for interactive CLI coding agents compared to Claude Opus 5.5 or DeepSeek V4.1 Flash.

Comparison: tencent/hy4 vs. Qwen 3.8 Max, LongCat-2.5, DeepSeek V4.1 Flash, and GLM-5.3

Every major Chinese lab now offers a 1,000,000-token context window, so picking the right API comes down to token economics, vision support, and latency tolerance.

Feature / Metric (as of 2026-11-06) Tencent Hy4 (tencent/hy4) Meituan LongCat-2.5 DeepSeek V4.1 Flash (1017) Qwen 3.8 Max (0902) GLM-5.3 (Z.ai)
Input Price (/1M) $0.834 $0.30 $0.15 $1.65 – $2.00 $1.40
Output Price (/1M) $2.501 $1.20 $0.60 $4.95 – $6.00 $4.40
Cache Read (/1M) $0.042 (95% off) $0.006 (98% off) $0.006 – $0.015 $0.25 $0.26
Context Window 1,000,000 (960K in) 1,000,000 1,000,000 1,000,000 1,000,000
Max Output Tokens 64,000 8,000 – 16,000 64,000 131,072 64,000
Architecture 770B MoE (49B active) 1.6T MoE (~110B active) 552B MoE (~37B active) Flagship Hybrid MoE 600B+ MoE
Vision Input Yes (Text + Image) No (Text-only) Via VL variant Yes (Omni / VL) Yes
Best Use Case Financial/legal/medical docs, UI dashboards, multimodal RAG High-volume 1M text caching & retrieval Fast coding agents, SVG/frontend logic, math Production tool calling & 131K long generation Formal code migration & logic proofs
Main Bottleneck 103s TTFT & 160M-token verbosity inflate bills Strict rate limits on burst concurrency Weaker multimodal layout taste on base model Highest per-token cost in this group Peak-hour queue latency

Here is how I decide which endpoint to route a task to:

If you are building interactive coding agents, CLI tools, or fast frontend components, stay on DeepSeek V4.1 Flash (1017). At $0.15 input and $0.60 output, it is more than four times cheaper on output rate than tencent/hy4 (as of 2026-11-06), finishes math and SVG generation in a fraction of the time, and avoids 103-second first-token stalls.

If your workload is pure-text 1M-context RAG with heavy prefix caching, route to Meituan LongCat-2.5. While Hy4's $0.042/1M cache read rate is good, LongCat-2.5 drops cache reads all the way to $0.006 per 1M tokens (a 98% discount) and charges less than half as much on uncached tokens (as of 2026-11-06). You can see the full breakdown of its cache math and temperature rules in our Meituan LongCat-2.5 API Pricing and Benchmark Guide.

If you need maximum output length (up to 131K tokens) or rock-solid multi-step tool calling, Qwen 3.8 Max justifies its $1.65–$2.00 input premium (as of 2026-11-06).

Switch to Tencent Hy4 (tencent/hy4) when your pipeline runs asynchronous financial, legal, or medical document review, requires native image-plus-text comprehension inside a 960K input window, or generates data visualization dashboards and 3D web prototypes where a 7.2% hallucination rate and strong layout aesthetics matter more than sub-second latency. Set your HTTP client timeouts to 900 seconds, stream your responses, and use the $0.042/1M cache hit tier (as of 2026-11-06) to keep its verbose reasoning chains from inflating your bill. If you need to create or edit images rather than read them, we cover an open-weights model for image generation and editing separately.

Sources and checks

  1. OpenRouter
  2. Tencent Cloud International TokenHub
  3. Hugging Face
  4. Tencent Cloud's specification sheet
  5. OpenRouter: Tencent Hy4 flash
  6. Hy4 flash on Tencent Cloud TI Platform (llmreference)
  7. Hugging Face: tencent/Hy4-flash