---
title: "Hy4 flash"
description: "Tencent's open-weight Hy4 flash, a very low-cost model with a 1M token context window and image input. It is the most popular model in the registry by rank."
canonical: https://pydantic.dev/models/list/hy4-flash/
---

# Hy4 flash

> Tencent's open-weight Hy4 flash, a very low-cost model with a 1M token context window and image input. It is the most popular model in the registry by rank.
>
> Markdown copy of [https://pydantic.dev/models/list/hy4-flash/](https://pydantic.dev/models/list/hy4-flash/). Index for agents: [llms.txt](https://pydantic.dev/models/llms.txt)

**Agents: use the API for model information.** It answers a question in one request, where the pages need several.

- Choose a model for an agent: `POST https://pydantic.dev/models/api/select` with a JSON body such as `{"description": "what the agent does"}`. It returns up to five ranked models with reasons. Format: [select.md](https://pydantic.dev/models/select.md)
- Search models by name: `GET https://pydantic.dev/models/api/search?query=<text>`
- List, filter and sort models: `GET https://pydantic.dev/models/api/models`, for example `?weights=open&max_price=2&sort=efficiency`
- One model in full: `GET https://pydantic.dev/models/api/models/<slug>`
- Any other question about the models: `GET https://pydantic.dev/models/api/ask?query=<question>`

Add `intent=<intent>&stack=<stack>&harness=<harness>` to the query string of all but the single model. An `OPTIONS` request to any endpoint returns its schema. The same five are tools of the MCP server at `https://pydantic.dev/models/mcp`. More: [usage.md](https://pydantic.dev/models/usage.md)

Use it with Pydantic AI as `fireworks:hy4-flash`.

## Spec sheet

- **Type:** writes text
- **Family:** Tencent
- **Released:** 16 Nov 2026
- **Weights:** open
- **Context window:** 1,000,000 tokens
- **Largest response:** 65,536 tokens
- **Accepts:** text, image
- **Tool calling:** yes
- **Knowledge cutoff:** unknown
- **Intelligence index:** not enough benchmark results yet
- **Scores updated:** unknown
- **Price:** $0.07 input, $0.28 output, $0.12 blended per 1M tokens
- **Index points per $:** – (rank –)
- **Speed:** 60.5 tokens/sec (rank 112)
- **Popularity:** rank 1 of 222 by usage
- **Pydantic AI Gateway:** not built in; [bring your own key](https://ai.pydantic.dev/gateway/#bring-your-own-key)

## Benchmarks


No results yet on the benchmarks we track.

## Providers and prices

US dollars per million tokens.

| Provider  | Gateway | Pydantic AI string    | Input  | Cached input | Output |
| --------- | ------- | --------------------- | ------ | ------------ | ------ |
| Novita    | BYOK    | –                     | $0.035 | $0.002       | $0.14  |
| Fireworks | BYOK    | `fireworks:hy4-flash` | $0.07  | $0.003       | $0.28  |

## Use Hy4 flash with Pydantic AI

### hello.py

Ask Hy4 flash a question with a Pydantic AI agent and print the answer. Run it with uv run hello.py.

```python
# /// script
# dependencies = ["pydantic-ai"]
# ///
import os

from pydantic_ai import Agent

os.environ['FIREWORKS_API_KEY'] = '...'

agent = Agent('fireworks:hy4-flash', instructions='Be concise, reply with one sentence.')

result = agent.run_sync('Where does "hello world" come from?')
print(result.output)
```

### structured_output.py

Get validated, typed output from Hy4 flash by giving the agent a Pydantic model. Run it with uv run structured_output.py.

```python
# /// script
# dependencies = ["pydantic-ai"]
# ///
import os

from pydantic import BaseModel
from pydantic_ai import Agent

os.environ['FIREWORKS_API_KEY'] = '...'


class CityLocation(BaseModel):
    city: str
    country: str


agent = Agent('fireworks:hy4-flash', output_type=CityLocation)

result = agent.run_sync('Where were the olympics held in 2012?')
print(result.output)
#> city='London' country='United Kingdom'
```

### tools.py

Give Hy4 flash two tools to call, one of which reads the agent's dependencies. Run it with uv run tools.py.

```python
# /// script
# dependencies = ["pydantic-ai"]
# ///
import os
import random

from pydantic_ai import Agent, RunContext

os.environ['FIREWORKS_API_KEY'] = '...'

agent = Agent(
    'fireworks:hy4-flash',
    deps_type=str,
    instructions="You're a dice game, roll the die and see if it matches the user's guess.",
)


@agent.tool_plain
def roll_dice() -> str:
    """Roll a six-sided die and return the result."""
    return str(random.randint(1, 6))


@agent.tool
def get_player_name(ctx: RunContext[str]) -> str:
    """Get the player's name."""
    return ctx.deps


result = agent.run_sync('My guess is 4', deps='Anne')
print(result.output)
```

### streaming.py

Stream Hy4 flash's reply to the terminal as it is generated. Run it with uv run streaming.py.

```python
# /// script
# dependencies = ["pydantic-ai"]
# ///
import asyncio
import os

from pydantic_ai import Agent

os.environ['FIREWORKS_API_KEY'] = '...'

agent = Agent('fireworks:hy4-flash')


async def main():
    async with agent.run_stream('Explain prompt caching in three bullet points.') as response:
        async for text in response.stream_text(delta=True):
            print(text, end='', flush=True)


asyncio.run(main())
```

### pax.sh

Code with Hy4 flash in your terminal using Pax, the Pydantic AI coding agent.

```sh
export FIREWORKS_API_KEY='...'

uv run --from pydantic-ai-pax pax -m 'fireworks:hy4-flash'
```

### codex.sh

Run OpenAI's Codex CLI on Hy4 flash, which Fireworks serves over an OpenAI-compatible API.

```sh
# npm install -g @openai/codex
export FIREWORKS_API_KEY='...'

codex --model 'hy4-flash' \
  -c model_provider='fireworks' \
  -c model_providers.fireworks.name='Fireworks' \
  -c model_providers.fireworks.base_url='https://api.fireworks.example/v1' \
  -c model_providers.fireworks.env_key='FIREWORKS_API_KEY'
```

### ai_sdk.ts

Call Hy4 flash from TypeScript with the Vercel AI SDK.

```ts
// npm install ai @ai-sdk/openai-compatible
import { createOpenAICompatible } from '@ai-sdk/openai-compatible'
import { generateText } from 'ai'

process.env.FIREWORKS_API_KEY = '...'

const fireworks = createOpenAICompatible({
  name: 'fireworks',
  baseURL: 'https://api.fireworks.example/v1',
  apiKey: process.env.FIREWORKS_API_KEY,
})

const { text } = await generateText({
  model: fireworks('hy4-flash'),
  system: 'Be concise, reply with one sentence.',
  prompt: 'Where does "hello world" come from?',
})
console.log(text)
```

## About Hy4 flash

Hy4 flash costs $0.07 per million input tokens and $0.28 per million output tokens and has a 1M token context window.

Hy4 flash is an open-weight model from Tencent, released in November 2026. Its main appeal is price: $0.07 per million input tokens and $0.281 per million output tokens, a blended rate of $0.12 that ranks 9th cheapest of 222 models and sits well below the registry median of $0.80. It is also the most popular model in the registry by rank.

The model offers a 1M token context window, responses up to 65k tokens, text and image input, tool calling, structured output and a reasoning mode. These features cover most agent needs. The registry holds no benchmark results for it, however, so its performance on reasoning or coding tasks cannot be measured against other models, and no intelligence index value is available.

It is served by only two providers, Novita and Fireworks, which limits routing options if one fails. Its knowledge cutoff is not recorded. Teams should test its output quality on their own tasks before relying on it.

**Strengths**

- Blended price of $0.12 per million tokens, 9th cheapest of 222
- Popularity rank 1 of 222, the most popular model in the registry
- 1M token context window with responses up to 65k tokens
- Supports tool calling, structured output and a reasoning mode

**Weaknesses**

- No benchmark results, so its capability cannot be compared with other models
- Served by only two providers, Novita and Fireworks
- No intelligence index score is available

**Best for:** Cost-sensitive agents and high-volume tasks where price matters more than proven benchmark results, especially long-context or image-aware workflows.

Prices come from [genai-prices](https://github.com/pydantic/genai-prices), in US dollars per million tokens. Benchmark scores come from Epoch AI and LMArena (CC BY 4.0), Browser Use, our own Pydantic AI benchmarks (CC BY 4.0), and, for decision models, Artificial Analysis and the Jev Decision Index; the index and its sources are described in [the methodology](https://pydantic.dev/models/methodology.md). Data built 2026-12-04. This model from the API: `https://pydantic.dev/models/api/models/hy4-flash`. Compare it with others: `https://pydantic.dev/models/api/models?slug=hy4-flash,<other slug>`
