⌘K

Hy4

hy4

Hy4 is Tencent's language model for reasoning, agent workflows, and long-running productivity tasks. It supports text and image inputs, a 1024K token context window, up to 960K input tokens, and up to 64K output tokens.

Authentication

authorization string required

All APIs require authentication via Bearer Token.

Get API Key:

Visit API Key Management Page to get your API Key.

Usage:

Add to request header:

Authorization: Bearer YOUR_API_KEY

Parameters

model string required

Model ID to use for the request

Value: hy4


messages array required

Conversation history, with up to 960K input tokens; input and output must fit within the 1024K token context window

role string required

Message role

Options: system, user, assistant, tool

content string | array | null

Text string or an array of text and image content parts; assistant messages containing tool calls may use null

type string required

Content part type

Options: text, image_url

text string

Text content, required when type is text

image_url object

Image input, required when type is image_url Supports PNG, JPEG, WEBP, and non-animated GIF images, with up to 10 MB per decoded image and 600 images per request, including history Recommended image dimensions are approximately 128×128 to 2048×2048; larger images are downscaled, and images exceeding 5500×5500 are rejected

url string required

Publicly accessible image URL or a base64 data URL such as data:image/png;base64,...

detail string

Image processing detail level

Default: auto

Options: auto, low, high

reasoning_content string

Reasoning text from a previous assistant message; preserve the returned value when continuing a reasoning conversation, especially across tool calls

tool_calls array

Tool calls from a previous assistant message; preserve the returned tool call objects in conversation history

id string required

Tool call identifier

type string required

Value: function

function object required

Called function

name string required

Function name

arguments string required

Function arguments encoded as a JSON string

tool_call_id string

Required for tool messages; matches the identifier of the tool call whose result is provided in content


max_tokens integer

Maximum output token budget, including reasoning tokens; reserve sufficient tokens for both reasoning and the final answer

Range: 1-64K


temperature number

Sampling temperature; higher values increase randomness. Usually adjust either temperature or top_p

Range: 0.0-2.0


top_p number

Nucleus sampling probability threshold

Range: (0.0, 1.0]


thinking object

Controls deep thinking; reasoning is returned in reasoning_content separately from the final answer in content

type string required

Thinking switch

Default: enabled

Options: enabled, disabled


reasoning_effort string

Reasoning effort; no_think disables reasoning

Default: high

Options: high, no_think


stream boolean

Return incremental Server-Sent Events (SSE); chunks use chat.completion.chunk and expose generated content through choices[].delta, ending with data: [DONE]

Default: false

Options: true, false


stream_options object

Streaming options, used with stream: true

include_usage boolean

Request a final usage chunk before [DONE]; that chunk may contain an empty choices array


tools array

Function tools available to the model; your application executes returned tool calls and supplies results as tool messages before the next request

type string required

Value: function

function object required

Function definition

name string required

Function name

description string

Description of the function and when to use it

parameters object

Function input schema in JSON Schema format


tool_choice string | object

Tool selection strategy; auto lets the model decide, none disables tool calls, and required forces a tool call To select a function, use {"type":"function","function":{"name":"FUNCTION_NAME"}} Disable thinking with thinking.type: disabled when using required or selecting a specific function

Default: auto

Options: auto, none, required, a function selection object


response_format object

Output format constraint; when requesting json_object, explicitly instruct the model to produce JSON in messages

type string required

Output format

Default: text

Options: text, json_object, json_schema

json_schema object

Required when type is json_schema

name string required

Schema name

schema object required

JSON Schema describing the expected output structure


stop string | array

Stop generation when a matching sequence is encountered; accepts up to 4 stop sequences

Response Format

id string

Unique identifier for the completion


object string

Object type

Value: chat.completion


created integer

Unix timestamp of response creation in seconds


model string

Model used for the completion


choices array

Completion choices

index integer

Choice index

message object

Generated assistant message

role string

Value: assistant

content string | null

Final answer text; may be null when a tool call is returned

reasoning_content string

Reasoning text when thinking is enabled

tool_calls array

Tool calls to execute; each item contains id, type: function, and function with name and JSON-encoded arguments

finish_reason string

Reason generation ended, such as stop, length, tool_calls, or content_filter


usage object

Token usage statistics

prompt_tokens integer

Input token count

completion_tokens integer

Output token count, including reasoning tokens

total_tokens integer

Total input and output token count

prompt_tokens_details object

Optional input token details

cached_tokens integer

Input tokens served from cache

completion_tokens_details object

Optional output token details

reasoning_tokens integer

Tokens consumed by reasoning