Tencent released Hy4, its newest large language model, on 4 November 2026. It is the first Hy model with visual understanding, and Tencent says it is much better at following instructions, handling long context and running long, multi-step agent tasks. The API is already live on OpenRouter, so you can try it from any OpenAI-compatible client in a few minutes.

This guide shows how to call Hy4 from Python, how to use tool calling, how to send an image, and how to get structured JSON back. Every figure below comes from Tencent’s announcement or the OpenRouter model page. Both are linked at the end.

What is new in Hy4

According to Tencent’s launch post, Hy4 brings:

  • Visual understanding for the first time, including fine-grained image processing, complex chart analysis and mathematical visual reasoning.
  • Computer use: it can work with both command-line and graphical interfaces. Tencent says it was given special training on professional software such as Blender and CAD.
  • Better agent behaviour: stronger instruction following, long-context comprehension and long-horizon agentic tasks than Hy4 Preview.
  • Open weights are planned: Tencent says model weights and system cards will be released “in the coming days”, with a focus on cybersecurity and biological safety.

On pricing, Tencent says Hy4 costs the same as Hy4 Preview: about US$0.90 per million input tokens, US$2.70 per million output tokens and US$0.045 per million cached input tokens. Tencent Cloud TokenHub is also offering 50% off until 31 December 2026, so check the live price before you budget.

The OpenRouter listing gives these technical details:

  • Model ID: tencent/hy4
  • Context window: 1,048,576 tokens, with up to 65,536 completion tokens
  • Input: text and images. Output: text
  • Supports tools / tool_choice for function calling and response_format with a JSON schema

Step 1: Set up your environment

OpenRouter’s API is OpenAI-compatible, so the official openai Python package works. You only need to change the base URL.

python -m venv .venv
source .venv/bin/activate      # Windows: .venv\Scripts\activate
pip install openai
export OPENROUTER_API_KEY="sk-or-..."   # create a key in your OpenRouter dashboard

Never hard-code the key in your source files. Read it from the environment as shown below.

Step 2: Your first request

import os
from openai import OpenAI

client = OpenAI(
    base_url="https://openrouter.ai/api/v1",
    api_key=os.environ["OPENROUTER_API_KEY"],
)

resp = client.chat.completions.create(
    model="tencent/hy4",
    messages=[
        {"role": "system", "content": "You are a concise senior Python reviewer."},
        {"role": "user", "content": "Explain the difference between a list and a tuple in 3 bullet points."},
    ],
)

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

That’s all you need for a basic chat call. Because the model ID is just a string, you can keep it in a config file and swap models without changing code.

Step 3: Tool calling (function calling)

Hy4 is built for agent workflows, so tool calling is where it is most useful. The pattern is the same as other OpenAI-style models: describe your tools as JSON schemas, let the model decide when to call one, run the function yourself, then send the result back.

import json

def get_weather(city: str) -> dict:
    # Replace with a real API call
    return {"city": city, "temp_c": 24, "condition": "Clear"}

tools = [{
    "type": "function",
    "function": {
        "name": "get_weather",
        "description": "Get the current weather for a city",
        "parameters": {
            "type": "object",
            "properties": {"city": {"type": "string"}},
            "required": ["city"],
        },
    },
}]

messages = [{"role": "user", "content": "Should I carry an umbrella in Delhi today?"}]

first = client.chat.completions.create(
    model="tencent/hy4", messages=messages, tools=tools, tool_choice="auto"
)
msg = first.choices[0].message

if msg.tool_calls:
    messages.append(msg)  # keep the assistant's tool request in history
    for call in msg.tool_calls:
        args = json.loads(call.function.arguments)
        result = get_weather(**args)
        messages.append({
            "role": "tool",
            "tool_call_id": call.id,
            "content": json.dumps(result),
        })
    final = client.chat.completions.create(model="tencent/hy4", messages=messages, tools=tools)
    print(final.choices[0].message.content)
else:
    print(msg.content)

A few tips for agent loops:

  • Always validate the arguments the model sends before you run anything with side effects.
  • Put a limit on the number of tool rounds so a confused agent cannot loop forever.
  • Log every tool call. It makes debugging much easier.

Step 4: Send an image

Since Hy4 now accepts images, you can ask it about charts, screenshots or diagrams. Use the standard multi-part message format with an image_url part. A public URL works, and so does a base64 data URL for local files.

import base64

with open("sales-chart.png", "rb") as f:
    b64 = base64.b64encode(f.read()).decode()

resp = client.chat.completions.create(
    model="tencent/hy4",
    messages=[{
        "role": "user",
        "content": [
            {"type": "text", "text": "Summarise the trend in this chart in two sentences."},
            {"type": "image_url", "image_url": {"url": f"data:image/png;base64,{b64}"}},
        ],
    }],
)
print(resp.choices[0].message.content)

Step 5: Get structured JSON back

When your code needs to parse the answer, ask for a JSON schema with response_format. That is far more reliable than asking for JSON in the prompt and hoping.

schema = {
    "name": "bug_report",
    "strict": True,
    "schema": {
        "type": "object",
        "properties": {
            "title": {"type": "string"},
            "severity": {"type": "string", "enum": ["low", "medium", "high"]},
            "steps": {"type": "array", "items": {"type": "string"}},
        },
        "required": ["title", "severity", "steps"],
        "additionalProperties": False,
    },
}

resp = client.chat.completions.create(
    model="tencent/hy4",
    messages=[{"role": "user", "content": "Users say the login button does nothing on Safari after the last deploy."}],
    response_format={"type": "json_schema", "json_schema": schema},
)

report = json.loads(resp.choices[0].message.content)
print(report["severity"], report["title"])

Using the 1M-token context sensibly

A 1,048,576-token window means you can pass whole codebases or long document sets in one request. That doesn’t mean you always should:

  • Cost grows with input. Every token you send is billed, so trim what the model doesn’t need.
  • Reuse prompts. Tencent lists a much lower cached-input price, so keep a long, stable prefix (system prompt, reference docs) at the start of the conversation and change only the end.
  • Still chunk when you can. For search-style tasks, retrieval plus a smaller context is usually faster and cheaper.

When to choose Hy4

Hy4 is worth testing if you are building coding agents, document or chart analysis tools, or long multi-step workflows on a budget. Run your own evaluation on your own tasks before you switch production traffic. Public benchmark numbers rarely match real workloads, and Hy4 is a brand-new release.

Key takeaways

  • Hy4 launched on 4 November 2026 with image understanding, computer use and stronger agent skills.
  • Call it through OpenRouter with the model ID tencent/hy4 and any OpenAI-compatible SDK.
  • It supports tool calling, image input and JSON-schema output, with a 1M-token context window.
  • Watch the pricing page, because launch discounts end, and keep an eye out for the promised open-weight release.

Sources: Tencent: Tencent Launches Hy4 ยท OpenRouter: Tencent Hy4