切换主题
OpenAI聊天格式
Gemini 图片生成
OpenAI聊天格式
POST /v1/chat/completions
Gemini 图片生成
认证
BearerAuth
请求体
必填:否
application/json
| 字段 | 必填 | 类型 | 说明 |
|---|---|---|---|
| model | 是 | string | - |
| stream | 是 | boolean | - |
| messages | 是 | array<object> | - |
| messages[].role | 否 | string | - |
| messages[].content | 否 | string | - |
| extra_body | 否 | object | - |
| extra_body.google | 是 | object | - |
| extra_body.google.image_config | 是 | object | - |
| extra_body.google.image_config.aspect_ratio | 是 | string | - |
| extra_body.google.image_config.image_size | 是 | string | - |
| contents | 是 | array<object> | - |
| contents[].role | 否 | string | - |
| contents[].parts | 否 | array<object> | - |
原始 Schema
json
{
"type": "object",
"properties": {
"model": {
"type": "string"
},
"stream": {
"type": "boolean"
},
"messages": {
"type": "array",
"items": {
"type": "object",
"properties": {
"role": {
"type": "string"
},
"content": {
"type": "string"
}
},
"x-apifox-orders": [
"role",
"content"
]
}
},
"extra_body": {
"type": "object",
"properties": {
"google": {
"type": "object",
"properties": {
"image_config": {
"type": "object",
"properties": {
"aspect_ratio": {
"type": "string"
},
"image_size": {
"type": "string"
}
},
"required": [
"aspect_ratio",
"image_size"
],
"x-apifox-orders": [
"aspect_ratio",
"image_size"
]
}
},
"required": [
"image_config"
],
"x-apifox-orders": [
"image_config"
]
}
},
"required": [
"google"
],
"x-apifox-orders": [
"google"
]
},
"contents": {
"type": "array",
"items": {
"type": "object",
"properties": {
"role": {
"type": "string"
},
"parts": {
"type": "array",
"items": {
"type": "object",
"properties": {
"text": {
"type": "string"
}
},
"x-apifox-orders": [
"text"
]
}
}
},
"x-apifox-orders": [
"role",
"parts"
]
}
}
},
"required": [
"model",
"stream",
"messages",
"contents"
],
"x-apifox-orders": [
"model",
"stream",
"messages",
"extra_body",
"contents"
]
}响应
200 成功
application/json
| 字段 | 必填 | 类型 | 说明 |
|---|---|---|---|
| id | 是 | string | - |
| model | 是 | string | - |
| object | 是 | string | - |
| created | 是 | integer | - |
| choices | 是 | array<object> | - |
| choices[].index | 否 | integer | - |
| choices[].message | 否 | object | - |
| choices[].message.role | 是 | string | - |
| choices[].message.content | 是 | string | - |
| choices[].finish_reason | 否 | string | - |
| usage | 是 | object | - |
| usage.prompt_tokens | 是 | integer | - |
| usage.completion_tokens | 是 | integer | - |
| usage.total_tokens | 是 | integer | - |
原始 Schema
json
{
"type": "object",
"properties": {
"id": {
"type": "string"
},
"model": {
"type": "string"
},
"object": {
"type": "string"
},
"created": {
"type": "integer"
},
"choices": {
"type": "array",
"items": {
"type": "object",
"properties": {
"index": {
"type": "integer"
},
"message": {
"type": "object",
"properties": {
"role": {
"type": "string"
},
"content": {
"type": "string"
}
},
"required": [
"role",
"content"
],
"x-apifox-orders": [
"role",
"content"
]
},
"finish_reason": {
"type": "string"
}
},
"x-apifox-orders": [
"index",
"message",
"finish_reason"
]
}
},
"usage": {
"type": "object",
"properties": {
"prompt_tokens": {
"type": "integer"
},
"completion_tokens": {
"type": "integer"
},
"total_tokens": {
"type": "integer"
}
},
"required": [
"prompt_tokens",
"completion_tokens",
"total_tokens"
],
"x-apifox-orders": [
"prompt_tokens",
"completion_tokens",
"total_tokens"
]
}
},
"required": [
"id",
"model",
"object",
"created",
"choices",
"usage"
],
"x-apifox-orders": [
"id",
"model",
"object",
"created",
"choices",
"usage"
]
}