gemini-4-hydrogen

别名Gemini 4 Hydrogen
由 Google 提供文本

Gemini 4 Hydrogen 面向日常开发和智能体执行,支持 Gemini Chat Completions 与原生 generateContent,token 费率比官方价低 40%。

更新于:
输入MessagesGemini 聊天格式
输出文本JSON 或流式
返回方式同步或流式stream 可选
价格优惠 40%官方价
gemini-4-hydrogen对话示例
你

Create a short security checklist for a browser client that submits API jobs. Keep the answer practical for a gemini-4-hydrogen integration.

gemini-4-hydrogen 标志
gemini-4-hydrogen

Keep secrets server-side, authenticate every request, validate payloads before forwarding, use short-lived signed URLs for assets, and log security-relevant failures without recording secrets. This example is tailored to the gemini-4-hydrogen model page.

生成示例

请求与回复示例

01 · 安全审查gemini-4-hydrogen
你

Create a short security checklist for a browser client that submits API jobs. Keep the answer practical for a gemini-4-hydrogen integration.

gemini-4-hydrogen 标志
gemini-4-hydrogen

Keep secrets server-side, authenticate every request, validate payloads before forwarding, use short-lived signed URLs for assets, and log security-relevant failures without recording secrets. This example is tailored to the gemini-4-hydrogen model page.

02 · 架构选型gemini-4-hydrogen
你

Compare polling and webhooks for a team that needs reliable job completion updates. Keep the answer practical for a gemini-4-hydrogen integration.

gemini-4-hydrogen 标志
gemini-4-hydrogen

Polling is easier behind private networks and during early prototyping; webhooks reduce repeated requests in production but require a reachable verified endpoint and idempotent event handling. This example is tailored to the gemini-4-hydrogen model page.

03 · SQL 数据迁移gemini-4-hydrogen
你

Plan a safe migration that adds a required field to a large production table. Keep the answer practical for a gemini-4-hydrogen integration.

gemini-4-hydrogen 标志
gemini-4-hydrogen

Add the field as nullable first, backfill in small observable batches, deploy readers that tolerate both states, validate completion, then enforce the constraint in a separate release. This example is tailored to the gemini-4-hydrogen model page.

模型能力

gemini-4-hydrogen 能做什么

适用任务

Google 面向日常编程和智能体执行的快速模型。

Chat Completions

通过 Gemini 兼容聊天接口提交 messages 和完整模型 ID。

Gemini 原生请求

使用 generateContent 接口设置 contents、系统指令、工具及模型支持的生成参数。

按 token 计费

输入、缓存输入和输出按 Google 官方价计算,再应用 TTAPI 的 40% 优惠。

计费

按 token 计费

支持的文本模型共用 API 密钥和账户余额。

Gemini 4 Hydrogen token 计费官方定价

每百万 token 的美元费率已含 TTAPI 40% 渠道优惠。输出计费包含思考 token,缓存输入使用隐式缓存。

PeriodInput / 1M缓存输入 / 百万 tokenOutput / 1M
截至 2026 年 12 月 31 日$0.9$0.045$4.5
自 2027 年 1 月 1 日起$0.90$0.09$4.50
API 请求

按操作查看请求

选择一个操作,查看对应接口和请求字段。

Gemini

Gemini Completions

兼容聊天格式。在请求体发送 messages 和 model,stream 为可选布尔值。

POSThttps://api.ttapi.io/gemini/chat/completions

请求头

TT-API-KEYstring必填

填写 TTAPI API 密钥。

Content-Typestring必填

使用 application/json。

请求体

messagesobject[]必填

按 TTAPI 文档传入带 role 和 content 的对话消息。

messages[].rolestring选填

消息角色,例如 user。

messages[].contentstring选填

这条对话消息的文本内容。

modelstring必填

填写请求示例中使用的 Gemini 模型 ID。

streamboolean选填

通过服务端发送事件逐步返回响应,默认 false。

查看当前渠道的接入文档
接入示例

查看选中渠道的代码示例

选择渠道和操作,再复制相应的接口地址、请求体或代码示例。

Gemini

Gemini Completions 接入示例

POST https://api.ttapi.io/gemini/chat/completions

curl --request POST \
  --url https://api.ttapi.io/gemini/chat/completions \
  --header "TT-API-KEY: $TTAPI_KEY" \
  --header 'Content-Type: application/json' \
  --data '{"model":"gemini-4-hydrogen","messages":[{"role":"user","content":"Review this migration plan and identify the three highest risks."}],"stream":false}'