Documentation Index
Fetch the complete documentation index at: https://docs.ominiapi.com/llms.txt
Use this file to discover all available pages before exploring further.
接口信息
POST https://www.ominiapi.com/v1beta/models/{model}:generateContent/
认证方式
使用 Bearer Token 进行认证。
| 参数 | 说明 |
|---|
| 格式 | Authorization: Bearer sk-xxxxxx |
| 位置 | Header |
路径参数
| 参数名 | 类型 | 必填 | 说明 |
|---|
| model | string | 是 | 模型名称 |
请求体 (Request Body)
Content-Type: application/json
| 参数名 | 类型 | 必填 | 说明 |
|---|
| contents | array<object> | 是 | 对话内容列表 |
| generationConfig | object | 是 | 生成配置参数 |
generationConfig 参数详情
| 参数名 | 类型 | 说明 |
|---|
| responseModalities | array<string> | 响应模态,指定生成内容的类型 |
| imageConfig | object | 图片生成配置 |
imageConfig 对象结构
| 参数名 | 类型 | 说明 |
|---|
| aspectRatio | string | 图片宽高比(如 “1:1”, “16:9”, “9:16”) |
| imageSize | string | 图片尺寸规格 |
响应体 (Response Body)
状态码: 200 (成功)
Content-Type: application/json
响应字段说明
| 字段名 | 类型 | 说明 |
|---|
| candidates | array<object> | 候选结果列表 |
| usageMetadata | object | 使用量统计信息 |
candidates 对象结构
| 字段名 | 类型 | 说明 |
|---|
| content | object | 生成的内容(包含 role 和 parts) |
| finishReason | string | 结束原因 |
| safetyRatings | array<object> | 安全评分 |
| 字段名 | 类型 | 说明 |
|---|
| promptTokenCount | integer | 提示词 token 数量 |
| candidatesTokenCount | integer | 候选结果 token 数量 |
| totalTokenCount | integer | 总 token 数量 |
请求示例
cURL
curl -X POST "https://www.ominiapi.com/v1beta/models/string:generateContent/" \
-H "Authorization: Bearer " \
-H "Content-Type: application/json" \
-d '{
"contents": [
{}
],
"generationConfig": {
"responseModalities": [
"string"
],
"imageConfig": {
"aspectRatio": "string",
"imageSize": "string"
}
}
}'
200
{
"candidates": [
{
"content": {
"role": "string",
"parts": [
{}
]
},
"finishReason": "string",
"safetyRatings": [
{}
]
}
],
"usageMetadata": {
"promptTokenCount": 0,
"candidatesTokenCount": 0,
"totalTokenCount": 0
}
}