curl --request POST \
--url https://api.omniall.ai/v1beta/models/{model}:streamGenerateContent \
--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 streamGenerateContent
Omniall AI 转发的 Google Gemini 原生流式 generateContent 接口(SSE)。
POST
/
v1beta
/
models
/
{model}
:streamGenerateContent
curl --request POST \
--url https://api.omniall.ai/v1beta/models/{model}:streamGenerateContent \
--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-...
请求体
application/json
Gemini 原生 generateContent 请求体(由 Omniall AI 转发)。最少包含一个 contents 轮次;生图时请设置 generationConfig.responseModalities 包含 IMAGE。