curl --request POST \
--url https://api.omniall.ai/v1beta/models/{model}:generateContent \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"contents": [
{
"role": "user",
"parts": [
{
"text": "你好,Gemini"
}
]
}
]
}
'
{
"candidates": [
{
"content": {
"role": "<string>",
"parts": [
{}
]
},
"finishReason": "<string>"
}
],
"usageMetadata": {
"promptTokenCount": 123,
"candidatesTokenCount": 123,
"totalTokenCount": 123
}
}{
"error": {
"message": "<string>",
"type": "new_api_error",
"code": "<string>"
}
}{
"error": {
"message": "无效的令牌 (request id: ...)",
"type": "new_api_error",
"code": ""
}
}{
"error": {
"message": "<string>",
"type": "new_api_error",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "new_api_error",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "new_api_error",
"code": "<string>"
}
}Gemini
Gemini generateContent
Omniall AI 转发的 Google Gemini 原生 generateContent 接口。支持视觉、文件、接地搜索与函数调用。
POST
/
v1beta
/
models
/
{model}
:generateContent
curl --request POST \
--url https://api.omniall.ai/v1beta/models/{model}:generateContent \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"contents": [
{
"role": "user",
"parts": [
{
"text": "你好,Gemini"
}
]
}
]
}
'
{
"candidates": [
{
"content": {
"role": "<string>",
"parts": [
{}
]
},
"finishReason": "<string>"
}
],
"usageMetadata": {
"promptTokenCount": 123,
"candidatesTokenCount": 123,
"totalTokenCount": 123
}
}{
"error": {
"message": "<string>",
"type": "new_api_error",
"code": "<string>"
}
}{
"error": {
"message": "无效的令牌 (request id: ...)",
"type": "new_api_error",
"code": ""
}
}{
"error": {
"message": "<string>",
"type": "new_api_error",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "new_api_error",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "new_api_error",
"code": "<string>"
}
}授权
使用来自 https://omniall.ai/dashboard 的 Authorization: Bearer sk-...
请求头
可选的 Gemini 风格 API Key 请求头。
路径参数
Gemini 模型 ID(模型广场 / GET /v1/models)。生图请选图像模型。
示例:
"gemini-3.1-flash-image-preview"
查询参数
可选的 Gemini 风格 API Key 查询参数。
请求体
application/json
Gemini 原生 generateContent 请求体(由 Omniall AI 转发)。最少包含一个 contents 轮次;生图时请设置 generationConfig.responseModalities 包含 IMAGE。
发给 Gemini 的有序对话轮次。每项为 user 或 model 的一条消息。
Show child attributes
Show child attributes
可选系统级指令,用于引导整次请求的模型行为(人设、输出
Show child attributes
Show child attributes
模型可调用的可选工具。例如启用时用 { "googleSearch": {} } 做接地/联网,或用 { "functionDeclarations": [ ... ] } 声明自有 Agent 函数。是否可用取决于模型/渠道。
控制工具选择方式(如函数调用模式)。透传为 Gemini toolConfig
本次生成的采样与输出控制。
Show child attributes
Show child attributes
按类别的安全阈值(骚扰、仇恨、色情、危险内容等)。需要时使用