thezakuloGet the newsletter
← All setup guides

Setup guide · 5 steps · about 10 minutes

How to start using Tencent: Hy4 flash

Tencent: Hy4 flash (tencent/hy4-flash) is a cost-efficient, 1M-context variant of Tencent's Hy4 model aimed at code assistance, agent pipelines, document and chart comprehension, and high-volume routine automation, callable through OpenRouter's API.

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

Through OpenRouter

  1. Get an API key

    Sign up at OpenRouter and create an API key from your dashboard. You will use it as the bearer token in every request.

  2. Export your key

    Store the key in an environment variable so the examples below can read it.

    export OPENROUTER_API_KEY=<your-key>
  3. Call the model with curl

    Send a POST request to the OpenRouter endpoint, setting the model to tencent/hy4-flash. The HTTP-Referer and title headers are optional and only affect leaderboard attribution.

    curl https://openrouter.ai/api/v1/responses \
      -H "Content-Type: application/json" \
      -H "Authorization: Bearer $OPENROUTER_API_KEY" \
      -d '{
      "model": "tencent/hy4-flash",
      "input": "What is the meaning of life?"
    }'
  4. Or call it from Python

    The same request works via HTTP in Python. Replace the input with your own prompt.

    import requests
    import json
    
    response = requests.post(
      url="https://openrouter.ai/api/v1/responses",
      headers={
        "Authorization": "Bearer <your-key>",
      },
      data=json.dumps({
        "model": "tencent/hy4-flash",
        "input": "What is the meaning of life?"
      })
    )
    print(response.json())
  5. Or use the OpenAI SDK pointed at OpenRouter

    OpenRouter is OpenAI-compatible, so you can use the OpenAI SDK by swapping the base URL and key.

    from openai import OpenAI
    
    client = OpenAI(
      base_url="https://openrouter.ai/api/v1",
      api_key="<your-key>",
    )
    
    response = client.responses.create(
      model="tencent/hy4-flash",
      input="What is the meaning of life?"
    )
    
    print(response.output_text)

Check it worked

You get a completed response containing the model's generated text instead of an authentication or model-not-found error.

Try these first

Get every issue by email

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

Subscribe