文本模型 · Google
Gemini 4 Hydrogen API 文档
Gemini 4 Hydrogen 是 Google 主打快与低成本的 Gemini 4 模型,2026 年 11 月 12 日发布。它会先推理再作答但不返回推理文本,是 TokenRa 上四款 Gemini 4 里最便宜的。
- 模型 ID
gemini-4-hydrogen- 接口格式
- Chat Completions
- 输入
- 文本
- 输出
- 文本
- 定位
- 快、低成本的 Gemini 4
- 面向 AI 代理
- llms.txt 指南
Capabilities
能力与接口
对话生成,走 OpenAI Chat Completions,已于 2026-12-02 在 tokenra.io 实测调用成功。快、低成本的 Gemini 4。
POSThttps://tokenra.io/v1/chat/completions已实测
OpenAI SDK 配
base_url="https://tokenra.io/v1",鉴权用 Authorization: Bearer。本模型不支持
- Anthropic Messages(
/v1/messages):该模型在网关只登记了openai接口类型。 - OpenAI Responses(
/v1/responses)同样未开放。
Request
请求参数
POST /v1/chat/completions 的字段,下面列出的都在实测中被模型接受。
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
model | string | 必填 | 要调用的模型 ID,例如 gemini-4-hydrogen。 |
messages | array | 必填 | 按顺序排列的对话消息,content 可以是字符串或分段数组。 |
stream | boolean | 可选 | 默认就是 true。省略该字段返回 text/event-stream;要单个 JSON 响应体请传 false。 |
stream_options | object | 可选 | 传 {"include_usage": true} 时最后一个分片带 usage。 |
max_tokens | integer | 可选 | 生成 token 上限;模型会推理时,推理 token 计入这个额度。 |
temperature | number | 可选 | 采样温度。 |
top_p | number | 可选 | 核采样阈值,通常与 temperature 二选一。 |
presence_penalty | number | 可选 | 对已出现过的 token 施加惩罚。 |
frequency_penalty | number | 可选 | 对高频 token 施加惩罚,减少重复。 |
tools | array | 可选 | 支持。带 tools 的请求返回 tool_calls,参数为 JSON,finish_reason 为 stop。 |
user | string | 可选 | 你自己的终端用户标识,用于审计,不进入对话。 |
价格
输入 $1.80 · 输出 $9.00 · 缓存输入 $0.09 / 1M token。Hydrogen 是 TokenRa 上四款 Gemini 4 里最便宜的一款。Hydrogen 是家族的通用默认档;实测一句提示就消耗了 567 个推理 token。
Response
响应格式
{
"id": "chatcmpl-20261202084533000000000hydrogen",
"model": "gemini-4-hydrogen",
"object": "chat.completion",
"created": 1796172333,
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "An API gateway is the single entry point that receives client requests, routes them to the right backend service, and handles shared concerns such as authentication, rate limiting and logging."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 41,
"completion_tokens": 48,
"total_tokens": 89,
"prompt_tokens_details": {
"cached_tokens": 0,
"text_tokens": 41
},
"completion_tokens_details": {
"text_tokens": 0,
"reasoning_tokens": 567
}
}
}| 字段 | 类型 | 说明 |
|---|---|---|
id | string | 本次调用的 ID,联系支持时附上它。 |
object | string | 流式时为 chat.completion.chunk,否则为 chat.completion。 |
created | integer | Unix 时间戳(秒)。 |
choices[0].message.content | string | 答案正文。 |
choices[0].finish_reason | string | 正常回复为 stop;模型发起函数调用时为 tool_calls。 |
usage.prompt_tokens | integer | 输入 token,按输入价计费。 |
usage.completion_tokens | integer | 输出 token,按输入价的 5 倍计费。 |
usage.completion_tokens_details.reasoning_tokens | integer | 输出 token 里有多少用在推理上,按输出价计费。 |
Errors
错误与限制
常见错误
| HTTP | error.code | 含义 | 怎么处理 |
|---|---|---|---|
401 | — | API Key 缺失、错误或已删除,消息为 Invalid token。 | 检查 Authorization: Bearer 请求头与控制台里的 Key。 |
400 | — | 请求体不是合法 JSON。 | 修正 JSON,并带上 Content-Type: application/json。 |
500 | invalid_request | 缺少必填字段,例如 messages。 | 补上消息里点名的字段,重试无用。 |
403 | insufficient_user_quota | 余额或套餐额度已用完。 | 在控制台充值后重试。 |
503 | model_not_found | 模型 ID 未知,或当前分组没有可用渠道。 | 在模型列表或 GET /v1/models 里核对 ID。 |
429 | — | 请求过于频繁。 | 指数退避后重试。 |
5xx | — | 上游供应商失败或超时。 | 重试几次;持续失败请保留请求 ID。 |
限制与说明
- Gemini 4 家族的流式默认值与网关其他模型不同:不传
stream会返回text/event-stream,客户端要一次性 JSON 时请显式写"stream": false。 - 支持函数调用:带
tools的请求返回tool_calls,此时content为空。 - 推理 token 记在
usage.completion_tokens_details.reasoning_tokens,但网关不返回推理文本;它们计入max_tokens并按输出价计费。 - 价格:输入 $1.80、输出 $9.00 / 1M token,缓存输入 $0.09。