hy4
混元 hy4
Use hy4 with the compatible FoxRouter API below. Prices and groups are synced from foxrouter.org/pricing when the documentation is built; account groups and availability are shown in the console.
#Pricing
List price
- Input
- ¥6 / 1M tokens
- Output
- ¥18 / 1M tokens
- Cache read
- ¥0.3 / 1M tokens
Price by groupUnit: ¥ / 1M tokens, list price × group multiplier
| Group | Input | Output | Cache read |
|---|---|---|---|
| default分组×1默认分组 | ¥6 | ¥18 | ¥0.3 |
| 国模svip分组(0.06x)×0.1国内模型就选这个分组(deepseek、glm等),比较稳定 | ¥0.6 | ¥1.8 | ¥0.03 |
| 国模特惠分组×0.04国内模型特惠,稳定性相对于svip分组会差一些 | ¥0.24 | ¥0.72 | ¥0.012 |
Prices and groups synced at 2026-11-01.
#Chat Completions
POST
https://foxrouter.org/v1/chat/completionsCreates model responses based on chat history. Supports streaming and non-streaming responses.
Compatible with OpenAI Chat Completions API.
#Authorization
| Name | Type | Required | Description |
|---|---|---|---|
Authorization | Bearer <token> | Yes | 使用 Bearer Token 认证。 格式: Authorization: Bearer sk-xxxxxx In: header |
#Example request
curl -X POST "https://foxrouter.org/v1/chat/completions" \
-H "Authorization: Bearer $FOXROUTER_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "hy4",
"messages": [
{
"role": "system",
"content": "string"
}
]
}'import os
import requests
url = "https://foxrouter.org/v1/chat/completions"
headers = {
"Authorization": "Bearer " + os.environ["FOXROUTER_API_KEY"],
"Content-Type": "application/json",
}
payload = """{
"model": "hy4",
"messages": [
{
"role": "system",
"content": "string"
}
]
}"""
response = requests.post(url, headers=headers, data=payload)
print(response.status_code)
print(response.text)const payload = {
"model": "hy4",
"messages": [
{
"role": "system",
"content": "string"
}
]
};
const response = await fetch("https://foxrouter.org/v1/chat/completions", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.FOXROUTER_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify(payload),
});
console.log(response.status, await response.text());import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Main {
public static void main(String[] args) throws Exception {
String payload = """
{
"model": "hy4",
"messages": [
{
"role": "system",
"content": "string"
}
]
}
""";
HttpRequest.Builder builder = HttpRequest.newBuilder()
.uri(URI.create("https://foxrouter.org/v1/chat/completions"))
.header("Authorization", "Bearer " + System.getenv("FOXROUTER_API_KEY"))
.header("Content-Type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString(payload))
.build();
HttpResponse<String> response = HttpClient.newHttpClient()
.send(builder.build(), HttpResponse.BodyHandlers.ofString());
System.out.println(response.statusCode());
System.out.println(response.body());
}
}#Request Body
application/json
| Name | Type | Required | Description |
|---|---|---|---|
model | string | Yes | 模型 ID |
messages | array<object> | Yes | 对话消息列表 |
temperature | number | No | 采样温度 · Default: 1 · Range: 0 <= value <= 2 |
top_p | number | No | 核采样参数 · Default: 1 · Range: 0 <= value <= 1 |
n | integer | No | 生成数量 · Default: 1 · Range: 1 <= value |
stream | boolean | No | 是否流式响应 · Default: false |
stream_options | object | No | |
stop | string|array<string> | No | 停止序列 |
max_tokens | integer | No | 最大生成 Token 数 |
max_completion_tokens | integer | No | 最大补全 Token 数 |
presence_penalty | number | No | Default: 0 · Range: -2 <= value <= 2 |
frequency_penalty | number | No | Default: 0 · Range: -2 <= value <= 2 |
logit_bias | object | No | |
user | string | No | |
tools | array<object> | No | |
tool_choice | string|object | No | |
response_format | object | No | |
seed | integer | No | |
reasoning_effort | string | No | 推理强度 (用于支持推理的模型) · Allowed: "low" | "medium" | "high" |
modalities | array<string> | No | |
audio | object | No |
#Response Body
#200 OK · application/json
{
"id": "string",
"object": "chat.completion",
"created": 0,
"model": "hy4",
"choices": [
{
"index": 0,
"message": {
"role": "system",
"content": "string",
"name": "string",
"tool_calls": [
{
"id": "string",
"type": "function",
"function": {
"name": "string",
"arguments": "string"
}
}
],
"tool_call_id": "string",
"reasoning_content": "string"
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 0,
"completion_tokens": 0,
"total_tokens": 0,
"prompt_tokens_details": {
"cached_tokens": 0,
"text_tokens": 0,
"audio_tokens": 0,
"image_tokens": 0
},
"completion_tokens_details": {
"text_tokens": 0,
"audio_tokens": 0,
"reasoning_tokens": 0
}
},
"system_fingerprint": "string"
}#400 Bad Request · application/json
{
"error": {
"message": "string",
"type": "string",
"param": "string",
"code": "string"
}
}#429 Too Many Requests · application/json
{
"error": {
"message": "string",
"type": "string",
"param": "string",
"code": "string"
}
}#Try it online
curl -X POST "https://foxrouter.org/v1/chat/completions" \
-H "Authorization: Bearer $FOXROUTER_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "hy4",
"messages": [
{
"role": "user",
"content": "Hello! Introduce yourself in one sentence."
}
],
"max_tokens": 256
}'import os
import requests
url = "https://foxrouter.org/v1/chat/completions"
headers = {
"Authorization": "Bearer " + os.environ["FOXROUTER_API_KEY"],
"Content-Type": "application/json",
}
payload = """{
"model": "hy4",
"messages": [
{
"role": "user",
"content": "Hello! Introduce yourself in one sentence."
}
],
"max_tokens": 256
}"""
response = requests.post(url, headers=headers, data=payload)
print(response.status_code)
print(response.text)const payload = {
"model": "hy4",
"messages": [
{
"role": "user",
"content": "Hello! Introduce yourself in one sentence."
}
],
"max_tokens": 256
};
const response = await fetch("https://foxrouter.org/v1/chat/completions", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.FOXROUTER_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify(payload),
});
console.log(response.status, await response.text());import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Main {
public static void main(String[] args) throws Exception {
String payload = """
{
"model": "hy4",
"messages": [
{
"role": "user",
"content": "Hello! Introduce yourself in one sentence."
}
],
"max_tokens": 256
}
""";
HttpRequest.Builder builder = HttpRequest.newBuilder()
.uri(URI.create("https://foxrouter.org/v1/chat/completions"))
.header("Authorization", "Bearer " + System.getenv("FOXROUTER_API_KEY"))
.header("Content-Type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString(payload))
.build();
HttpResponse<String> response = HttpClient.newHttpClient()
.send(builder.build(), HttpResponse.BodyHandlers.ofString());
System.out.println(response.statusCode());
System.out.println(response.body());
}
}