thezakuloGet the newsletter
← All setup guides

Setup guide · 4 steps · about 10 minutes

How to start using Tencent: Hy4

Tencent: Hy4 (model id tencent/hy4) is a 1M-context model with agentic capabilities, visual understanding, and support for tool calling; you call it over OpenRouter's OpenAI-compatible API to run coding agents, long-horizon productivity tasks, and document/chart comprehension.

Built from the official docs: openrouter.ai · Hy4 - API Pricing & Benchmarks · checked 20 November 2026

Through OpenRouter

  1. Get an API key

    Sign up on OpenRouter and create a key. You will pass it as a Bearer token in the Authorization header on every request.

  2. Call it with a raw HTTP request

    Send a POST to the responses endpoint with the model id tencent/hy4. Replace the placeholder with your key.

    curl https://openrouter.ai/api/v1/responses \
      -H "Content-Type: application/json" \
      -H "Authorization: Bearer <OPENROUTER_API_KEY>" \
      -d '{
      "model": "tencent/hy4",
      "input": "What is the meaning of life?"
    }'
  3. Or call it with the OpenAI SDK

    Point the OpenAI SDK at OpenRouter's base URL and use it as a drop-in replacement, since OpenRouter's API is OpenAI-compatible. Set the model to tencent/hy4.

    from openai import OpenAI
    
    client = OpenAI(
      base_url="https://openrouter.ai/api/v1",
      api_key="<OPENROUTER_API_KEY>",
    )
    
    response = client.responses.create(
      model="tencent/hy4",
      input="What is the meaning of life?"
    )
    
    print(response.output_text)
  4. Or call it with the OpenRouter client SDK

    Install the OpenRouter SDK and send a request with the model id tencent/hy4.

    pip install openrouter

Check it worked

A successful call returns a JSON response whose status is "completed" and whose output contains a message item with an output_text part holding the model's reply.

Try these first

Get every issue by email

One email a week with the written issue. Free, one-click unsubscribe

Subscribe