Hy4 Chat — How to Chat with Tencent Hy4

The official Hy4 release (November 4, 2026) is served as an OpenAI-compatible chat API with the model ID tencent/hy4. There is no separate consumer chat app published for it, so you chat with Hy4 by pointing any OpenAI-compatible client at a gateway endpoint. This page covers the base URL, a working chat loop, prompt patterns that suit a 1,048,576-token context, and what one message actually costs. Last updated: November 5, 2026.

tencent/hy4model ID
1Mcontext window
64Kmax output
$0.667per 1M input (TokenRa)
Create a Free Account →

hy4ai.com links to TokenRa as a gateway; we have no commercial relationship with TokenRa.

Hy4 Chat at a Glance

ItemValue
Model IDtencent/hy4
Base URL (OpenAI-compatible)https://tokenra.io/v1
Chat endpointhttps://tokenra.io/v1/chat/completions
Context window1,048,576 tokens (prompt + history + reply)
Maximum output64,000 tokens per response
Input price$0.834 / 1M tokens (OpenRouter list) · $0.667 on TokenRa
Output price$2.501 / 1M tokens (OpenRouter list) · $2.001 on TokenRa
Official releaseNovember 4, 2026

Because the endpoint is OpenAI-compatible, you do not need a Hy4-specific SDK. Existing chat code keeps working when you change the base URL and the model name. For full endpoint reference, authentication options, and SDK examples, see the Hy4 API page.

Three Ways to Chat with Hy4

1. Any OpenAI-compatible chat client

A chat client that lets you set a custom OpenAI base URL and API key can talk to Hy4 directly — self-hosted interfaces such as Open WebUI or LibreChat, or desktop clients such as Chatbox, are the usual choices. In those settings you enter the base URL https://tokenra.io/v1, the key you generated at the gateway, and the model name tencent/hy4. These clients are independent projects; confirm in their documentation that the version you use supports a custom base URL.

2. A minimal Python chat loop

The smallest working chat: keep the message history in a list and send the whole list on every turn. For a full SDK reference and authentication walkthrough, see the API page.

from openai import OpenAI

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

history = []
print("Type 'exit' to quit.")
while True:
    q = input("You: ").strip()
    if q.lower() in {"exit", "quit"}:
        break
    history.append({"role": "user", "content": q})

    resp = client.chat.completions.create(
        model="tencent/hy4",
        messages=history,
        max_tokens=2048,
    )
    answer = resp.choices[0].message.content
    history.append({"role": "assistant", "content": answer})
    print("Hy4:", answer)

Two things matter once a conversation gets long. First, the message history is re-sent every turn, so a 50-turn chat costs far more than 50 separate questions — trim or summarise older turns. Second, the 1,048,576-token context is a ceiling, not a target: keep the working window small unless the task genuinely needs the whole document.

3. A single request with 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": "system", "content": "You are a concise technical assistant."},
      {"role": "user", "content": "Summarise this changelog in five bullets."}
    ],
    "max_tokens": 800,
    "stream": true
  }'
Key handling: call the API from a server or a local script — never embed a production key in browser JavaScript or commit it to a public repository. If you must chat from a static page, proxy the request through your own backend so the key stays server-side.

Prompt Patterns That Suit a 1M-Token Context

A long context changes how you should write prompts. Sending a whole repository or a 200-page PDF is possible, but the useful patterns are narrower than "paste everything".

  • Put the instructions last. Long inputs push a system prompt far from the answer. Repeat the task right before the question, and the model follows it more reliably.
  • Ask for citations. With a long document in context, request section or line references so you can check answers instead of trusting them.
  • Use one document per turn rather than many. Six related files with clear separators outperform fifty files pasted together.
  • Ask for structure. JSON, tables or numbered lists reduce vague answers and make the output machine-checkable.
  • Keep a short rolling summary. For multi-session work, summarise the previous session into 300–500 tokens and carry that forward instead of the full transcript.

For evaluation, compare the same prompts against a cheaper model on routine requests. Hy4 is a good candidate for long-document reading, codebase questions and multi-step agent work; a smaller model is usually the better default for short factual questions.

What One Hy4 Chat Message Costs

Chat cost is input tokens plus output tokens. A typical exchange — a 2,000-token prompt and an 800-token reply — comes to roughly the following:

ScenarioInput costOutput costTotal
One exchange, TokenRa2,000 × $0.667/1M = $0.0013800 × $2.001/1M = $0.0016≈ $0.0029
One exchange, OpenRouter list2,000 × $0.834/1M = $0.0017800 × $2.501/1M = $0.0020≈ $0.0037
50-turn chat, 2,000 tokens each, TokenRaHistory is re-sent every turn; actual usage grows faster than 50 × one exchange≈ $0.15–$0.25

The third row is the one that surprises people: a 50-turn conversation does not cost 50 message prices, because each turn resends the accumulated history as input. Trimming old turns or summarising them is the cheapest single optimisation in any chat product built on a long-context model.

Note: Hy4 was officially released on November 4, 2026, and pricing has been stable at the listed rates. These totals are arithmetic on the published per-token prices, not estimates of your actual usage. Confirm current rates with your gateway before you commit to production budgets.

Hy4 Chat vs Hy4 Preview Chat

Developers who used the grey-testing model during August should note three differences before reusing old chat code.

ItemHy4 (official)Hy4 Preview
Model IDtencent/hy4tencent/hy4-preview
Context window1,048,576 tokens1,048,576 tokens
Maximum output64,000 tokens64,000 tokens
Input / output price$0.834 / $2.501 per 1M$0.834 / $2.501 per 1M
Visual input and computer useSupported, per release materialsNot available
Hallucination rate5.45%15.76%

In short: change the model ID and you get the same context limits and the same price, plus the new multimodal and agentic capabilities. The full history of the two versions is on the Hy4 vs Hy4 Preview page, and benchmark scores are on the benchmarks page.

Common Problems When Chatting with Hy4

The reply comes back as an error or a 404

Nine times out of ten the model name is wrong. The official release is tencent/hy4; if you carried over tencent/hy4-preview from August, the gateway may reject it or silently route you elsewhere.

The answer is cut off mid-sentence

You hit the output ceiling you set yourself, not the model's limit. Raise max_tokens or enable stream and read the chunks as they arrive.

Long chats get slow and expensive

This is expected: the whole history is resent as input on every turn. Summarise older turns, or start a new thread with a short carry-over summary.

The answer ignores part of a long document

Check where the instructions sit in the prompt, and whether the document was truncated at the provider's request limit. A gateway may cap request size below the model's context window — confirm that in the provider's documentation.

Frequently Asked Questions

How do I chat with Hy4?

Hy4 is served as an OpenAI-compatible chat API rather than a standalone consumer app. Point any OpenAI-compatible client at the base URL https://tokenra.io/v1, set the model to tencent/hy4, and add your API key. You can create an account at tokenra.io/register to generate the key.

Is there a free way to try Hy4 chat?

Registration at the gateway is free, and after that usage is metered per token: $0.667 per 1M input tokens and $2.001 per 1M output tokens on TokenRa (20% off the OpenRouter list price of $0.834 / $2.501). Check the gateway's current free-credit terms before you rely on them.

What is the Hy4 chat model ID?

The model ID for the official release is tencent/hy4. The earlier grey-testing version used tencent/hy4-preview.

How long a conversation can Hy4 handle?

Hy4 supports a 1,048,576-token context window covering the system prompt, the whole message history and the reply, with a maximum output of 64,000 tokens per response.

How much does one Hy4 chat message cost?

At TokenRa rates a single exchange — a 2,000-token prompt plus an 800-token reply — costs about $0.0029; at the OpenRouter list price the same exchange costs about $0.0037. Cost scales linearly with the tokens you send and receive.

Can I send images to Hy4 in a chat?

Release materials state that the official Hy4 supports visual input and computer use, which Hy4 Preview did not. Whether a specific gateway exposes image input in its chat endpoint depends on that gateway, so confirm it in the provider's documentation.