OminiApi 文档

Gemini

Google Gemini generateContent 格式接口

OminiApi Team接口参考约 5 分钟
POST https://omini.ominiapi.top/v1beta/models/{model}:generateContent
POST https://omini.ominiapi.top/v1beta/models/{model}:streamGenerateContent

请求和响应格式与 Gemini API 一致,模型名写在路径里。

示例

curl "https://omini.ominiapi.top/v1beta/models/模型名:generateContent" \
  -H "Content-Type: application/json" \
  -H "x-goog-api-key: $OMINI_API_KEY" \
  -d '{
    "contents": [{ "parts": [{ "text": "你好" }] }]
  }'

流式输出

使用 streamGenerateContent,并建议带上 ?alt=sse 以 SSE 格式返回:

curl "https://omini.ominiapi.top/v1beta/models/模型名:streamGenerateContent?alt=sse" \
  -H "Content-Type: application/json" \
  -H "x-goog-api-key: $OMINI_API_KEY" \
  -d '{ "contents": [{ "parts": [{ "text": "写一首短诗" }] }] }'

限制

  • 只支持 generateContent 和 streamGenerateContent,其他方法(如 countTokens、embedContent)返回 unsupported Gemini action。
  • 不支持 GET /v1beta/models 列出模型,请使用 模型列表 接口。
  • 模型名只能包含字母、数字、.、_、-。
  • Key 请放在请求头里,不支持 ?key= 参数。

本页目录