外观
Gemini 3.1 Flash Lite Image
gemini-3.1-flash-lite-image 是 Google 的 Gemini 3.1 Flash Lite Image 图片模型,面向速度、规模和低成本优化,适合把延迟和单次成本作为主要约束的产品工作流。
Google 官方说明该 Lite 模型不适合多参考图输入或多轮连续编辑。建议用于快速 1K 生成和简单编辑;如果需要更强参考一致性或更多输出档位,请使用 gemini-3.1-flash-image-preview。
API 形式
| 操作 | Endpoint | 模式 |
|---|---|---|
| 图片生成 | POST /v1/images/generations | 同步 |
| 图片生成任务 | POST /v1/async/images/generations | 异步 |
| 图片编辑 | POST /v1/images/edits | 同步 |
| 图片编辑任务 | POST /v1/async/images/edits | 异步 |
价格
| 模型 id | 输出档位 | 每张积分 |
|---|---|---|
gemini-3.1-flash-lite-image | 1K | 2 |
请求字段
该模型与 Pixapi 其他图片模型一样,使用 OpenAI 兼容图片字段。
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
model | string | 是 | 使用 gemini-3.1-flash-lite-image。 |
prompt | string | 是 | 描述要生成或编辑的图片。 |
image | string 或 string[] | 编辑必填 | 输入图片 URL。该 Lite 模型建议优先使用单张参考图。 |
n | number | 否 | 返回图片数量,当前仅支持传 1。 |
size | string | 否 | 输出比例:1:1、3:2、2:3、3:4、4:3、4:5、5:4、9:16、16:9 或 21:9。 |
示例
bash
curl https://api.pixapi.ai/v1/images/generations \
-H "Authorization: Bearer $PIXAPI_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gemini-3.1-flash-lite-image",
"prompt": "A polished product photo of a ceramic coffee cup",
"n": 1,
"size": "1:1"
}'py
import os
import requests
response = requests.post(
"https://api.pixapi.ai/v1/images/generations",
headers={
"Authorization": f"Bearer {os.environ['PIXAPI_KEY']}",
"Content-Type": "application/json",
},
json={
"model": "gemini-3.1-flash-lite-image",
"prompt": "A polished product photo of a ceramic coffee cup",
"n": 1,
"size": "1:1"
},
)
response.raise_for_status()
print(response.json())js
const response = await fetch('https://api.pixapi.ai/v1/images/generations', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.PIXAPI_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"model": "gemini-3.1-flash-lite-image",
"prompt": "A polished product photo of a ceramic coffee cup",
"n": 1,
"size": "1:1"
}),
});
if (!response.ok) {
throw new Error(await response.text());
}
console.log(await response.json());go
package main
import (
"bytes"
"fmt"
"io"
"net/http"
"os"
)
func main() {
body := []byte(`{
"model": "gemini-3.1-flash-lite-image",
"prompt": "A polished product photo of a ceramic coffee cup",
"n": 1,
"size": "1:1"
}`)
req, err := http.NewRequest(
"POST",
"https://api.pixapi.ai/v1/images/generations",
bytes.NewBuffer(body),
)
if err != nil {
panic(err)
}
req.Header.Set("Authorization", "Bearer "+os.Getenv("PIXAPI_KEY"))
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
result, _ := io.ReadAll(resp.Body)
fmt.Println(string(result))
}共享响应结构和图片编辑上传示例见 API 参考。
