Google 模型通过一个统一的异步任务 API 调用。用 POST /api/generate 发起任务,再轮询 GET /api/generate/{taskId} 直到完成。本系列提供 9 个端点。
概览
每个端点共享相同的外层结构 —— 只有 model 和 input 字段不同。可在模型市场的 playground 中运行任意一个。
认证
在 /api-keys 创建 API 密钥,然后作为 Bearer token 发送。已登录时从浏览器发起的请求也可通过会话 cookie 生效。
Authorization: Bearer <YOUR_API_KEY>创建任务
POST https://api.lithovas.com/api/generate请求体:{ "model": "<slug>", "input": { … } }
响应:{ "taskId": "<id>", "state": "waiting" }
查询结果
GET https://api.lithovas.com/api/generate/<taskId>响应:{ "taskId", "state": "waiting" | "success" | "fail", "resultUrls": [ … ], "creditsConsumed", "failMsg", "balance" }
state 变为 success 或 fail。失败任务不计费。端点
| 模型 | 任务 | model slug |
|---|---|---|
| Imagen 4 Fast | Text to Image | google/imagen4-fast |
| Imagen 4 Ultra | Text to Image | google/imagen4-ultra |
| Imagen 4 | Text to Image | google/imagen4 |
| Nano Banana Edit | Image to Image | google/nano-banana-edit |
| Nano Banana | Text to Image | google/nano-banana |
| Pro | Image to Image | google/pro-image-to-image |
| Nano Banana 2 | Text to Image | google/nanobanana2 |
| Nano Banana 2 Lite | Text to Image | google/nano-banana-2-lite |
| Gemini 3.1 Flash TTS | Text to Speech | google/gemini-3-1-flash-tts |
Imagen 4 Fast · Text to Image
google/imagen4-fastpromptstring必填Text prompt describing what you want to see (max 5000 characters)
negative_promptstring可选Description of what to discourage in generated images (max 5000 chars)
aspect_ratioenum<string>可选The aspect ratio of the generated image
seedinteger可选Random seed for reproducible generation
curl -X POST https://api.lithovas.com/api/generate \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "google/imagen4-fast",
"input": {
"prompt": "A cinematic red panda surfing through neon rain at dusk.",
"negative_prompt": "example",
"aspect_ratio": "16:9",
"seed": 42
}
}'Imagen 4 Ultra · Text to Image
google/imagen4-ultrapromptstring必填Text description of desired image (max 5000 chars)
negative_promptstring可选Description of elements to exclude from generation (max 5000 chars)
aspect_ratioenum<string>可选Output image aspect ratio
seedstring可选Random seed for reproducible results (max 500 chars)
curl -X POST https://api.lithovas.com/api/generate \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "google/imagen4-ultra",
"input": {
"prompt": "A cinematic red panda surfing through neon rain at dusk.",
"negative_prompt": "example",
"aspect_ratio": "1:1",
"seed": 42
}
}'Imagen 4 · Text to Image
google/imagen4promptstring必填The text prompt describing what you want to see (max 5000 characters)
negative_promptstring可选A description of what to discourage in the generated images (max 5000 chars)
aspect_ratioenum<string>可选The aspect ratio of the generated image
seedstring可选Random seed for reproducible generation (max 500 characters)
curl -X POST https://api.lithovas.com/api/generate \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "google/imagen4",
"input": {
"prompt": "A cinematic red panda surfing through neon rain at dusk.",
"negative_prompt": "example",
"aspect_ratio": "1:1",
"seed": 42
}
}'Nano Banana Edit · Image to Image
google/nano-banana-editpromptstring必填The prompt for image editing (max 5000 characters)
image_urlsarray<string>必填List of URLs of input images for editing, up to 10 images
output_formatenum<string>可选Output format for the generated images
aspect_ratioenum<string>可选Aspect ratio for the generated image
curl -X POST https://api.lithovas.com/api/generate \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "google/nano-banana-edit",
"input": {
"prompt": "A cinematic red panda surfing through neon rain at dusk.",
"image_urls": [
"https://example.com/input.jpg"
],
"output_format": "png",
"aspect_ratio": "1:1"
}
}'Nano Banana · Text to Image
google/nano-bananapromptstring必填The prompt for image generation (max 5000 characters)
output_formatenum<string>可选Output format for the images
aspect_ratioenum<string>可选Image aspect ratio configuration
image_sizeenum<string>可选Deprecated parameter; use aspect_ratio instead
nsfw_checkerboolean可选Disables content filtering when false
curl -X POST https://api.lithovas.com/api/generate \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "google/nano-banana",
"input": {
"prompt": "A cinematic red panda surfing through neon rain at dusk.",
"output_format": "png",
"aspect_ratio": "1:1",
"image_size": "1:1",
"nsfw_checker": false
}
}'Pro · Image to Image
google/pro-image-to-imagepromptstring必填Text description of image to generate (max 10000 characters)
image_inputarray<string>可选Input images as file URLs for transformation/reference (max 8 images, 30MB each)
aspect_ratioenum<string>可选Aspect ratio of generated image
resolutionenum<string>可选Resolution of generated image
output_formatenum<string>可选Format of output image
curl -X POST https://api.lithovas.com/api/generate \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "google/pro-image-to-image",
"input": {
"prompt": "A cinematic red panda surfing through neon rain at dusk.",
"image_input": [
"https://example.com/input.jpg"
],
"aspect_ratio": "1:1",
"resolution": "1K",
"output_format": "png"
}
}'Nano Banana 2 · Text to Image
google/nanobanana2promptstring必填Text description of image to generate (max 20000 chars)
image_inputarray<string>可选Input images as file URLs for transformation (max 14, up to 30MB)
aspect_ratiostring可选Aspect ratio of generated image
resolutionstring可选Output image resolution
output_formatstring可选Output image file format
curl -X POST https://api.lithovas.com/api/generate \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "google/nanobanana2",
"input": {
"prompt": "A cinematic red panda surfing through neon rain at dusk.",
"image_input": [
"https://example.com/input.jpg"
],
"aspect_ratio": "auto",
"resolution": "1K",
"output_format": "jpg"
}
}'Nano Banana 2 Lite · Text to Image
google/nano-banana-2-liteimage_urlsarray<string>可选Input image URL array for visual references; supports up to 10 images
promptstring必填Text prompt for image generation; max 20000 characters
aspect_ratioenum<string>必填Output image aspect ratio
curl -X POST https://api.lithovas.com/api/generate \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "google/nano-banana-2-lite",
"input": {
"image_urls": [
"https://example.com/input.jpg"
],
"prompt": "A cinematic red panda surfing through neon rain at dusk.",
"aspect_ratio": "auto"
}
}'Gemini 3.1 Flash TTS · Text to Speech
google/gemini-3-1-flash-ttspromptstring必填Text prompt describing the desired output.
curl -X POST https://api.lithovas.com/api/generate \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "google/gemini-3-1-flash-tts",
"input": {
"prompt": "a red panda surfing"
}
}'