Soul 2.0
用提示词从 33 种风格中选一种,生成 1–4 张写实的人像、穿搭、街拍照片,按张计费。
Soul 2.0(产品 soul)是创意模型,专门生成写实的人像、穿搭、街拍和 UGC 风格的照片。只用提示词生成:写好提示词,再从 33 种风格里选一种。一个任务生成 1–4 张,按张计费。
创建任务
https://api.nanoapi.ai/v1/tasks用所有模型共用的创建任务接口,model 传 "soul-2.0"。
请求头
| 请求头 | 必填 | 说明 |
|---|---|---|
Authorization | 是 | Bearer <API Key>,见鉴权 |
Content-Type | 是 | application/json |
Idempotency-Key | 否 | 每个新任务一个唯一字符串,建议用 UUID(1–255 个字符),见防止重复创建 |
请求体
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
model | string | 是 | soul-2.0 |
prompt | string | 是 | 描述要生成的图片,最长 8000 字符。@Image1 这类写法按普通文字处理 |
resolution | string | 是 | 1.5k 或 2k,价格相同 |
aspect_ratio | string | 是 | 1:1、16:9、9:16、4:3、3:4、3:2 或 2:3 |
style | string | 是 | 33 种风格之一,例如 flash_editorial。不需要特别的风格时传 general |
num_outputs | integer | 是 | 生成张数,1–4,每张单独生成。按该张数冻结,仅按实际生成的张数扣费,见价格 |
webhook_url | string | 否 | 任务成功或失败时通知该地址:https,最长 2048 字符,不能指向内网、回环或保留地址。见回调 |
传了其他参数(例如 image_urls、seed、负向提示词)属于请求错误。
用闪光大片(flash_editorial)风格生成 2 张 2k 的图:
curl https://api.nanoapi.ai/v1/tasks \
-H "Authorization: Bearer $NANOAPI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "soul-2.0",
"prompt": "a young woman in a denim jacket standing on a city street, natural light",
"resolution": "2k",
"aspect_ratio": "3:4",
"style": "flash_editorial",
"num_outputs": 2
}'响应:200 OK,返回新建的任务(字段说明)。保存 data.id,用它获取结果;任务创建后仍可能失败,见错误。
{
"code": 200,
"message": "success",
"data": {
"object": "task",
"id": "tk_01jbn7d2k9w4x6z8c1v3b5m7q9",
"model": "soul-2.0",
"status": "queued",
"error": null,
"created_at": "2026-11-23T08:30:00Z"
}
}获取结果
耗时仅供参考(开始生成到出图,不含排队,另加几秒转存;上游忙时会更慢):每张约 16–40 秒。传了 webhook_url 时通过回调获取结果,否则轮询 GET /v1/tasks/{task_id},间隔不少于 15 秒,直到 status 为 succeeded 或 failed(多个任务用列出任务的 ids 一次查询)。
上面的请求成功后(省略了其他字段,完整字段见任务对象):
{
"status": "succeeded",
"input": {
"prompt": "a young woman in a denim jacket standing on a city street, natural light",
"resolution": "2k",
"aspect_ratio": "3:4",
"style": "flash_editorial"
},
"num_outputs": 2,
"outputs": [
{
"index": 0,
"type": "image",
"url": "https://cdn.nanoapi.ai/h/tk_01jbn7d2k9w4x6z8c1v3b5m7q9_1_1795422690.png",
"preview_url": "https://cdn.nanoapi.ai/h/tk_01jbn7d2k9w4x6z8c1v3b5m7q9_1_1795422690_compressed.jpg"
},
{
"index": 1,
"type": "image",
"url": "https://cdn.nanoapi.ai/h/tk_01jbn7d2k9w4x6z8c1v3b5m7q9_2_1795422690.png",
"preview_url": "https://cdn.nanoapi.ai/h/tk_01jbn7d2k9w4x6z8c1v3b5m7q9_2_1795422690_compressed.jpg"
}
],
"billing": {
"currency": "USD",
"frozen": "…", // 2 × 每张单价
"charged": "…", // 相同
"refunded": "0.00",
"billed_seconds": null
}
}| 字段 | Soul 2.0 |
|---|---|
outputs | 每张生成出来的图片一项,最多 num_outputs 项 |
outputs[].type | image |
outputs[].url | PNG 原图,每张约 3–5MB,用于下载或查看大图,不要在列表里加载 |
outputs[].preview_url | JPEG 预览图,长边不超过 1024 像素,用于列表和缩略图,见结果 |
billing.billed_seconds | 始终为 null:图片按张计费 |
input | 传入的参数 |
出图尺寸
宽×高(像素),实测:
resolution | aspect_ratio | 尺寸 |
|---|---|---|
2k | 1:1 | 2048×2048 |
2k | 3:4 | 1536×2048 |
2k | 16:9 | 2048×1152 |
1.5k | 3:4 | 1152×1536 |
上面的请求生成 2 张 1536×2048 的图。
张数比请求的少
每张图单独生成。有几张没生成出来(例如被内容审核拦下)时,任务仍是 succeeded,outputs 里只有生成出来的那几张,比 num_outputs 少。只按这几张扣费,冻结金额的其余部分退回(billing.refunded)。一张都没生成出来时任务才是 failed,冻结金额全额退回:其中只要有 1 张是被内容审核拦下的,失败原因就是 content_policy(不一定每张都被拦,其余几张可能是别的原因),否则一般是 generation_failed。outputs[].index 按生成出来的那几张从 0 连续编号,张数比请求的少时不对应请求里的第几张,不要用它与请求中的图片对应。
风格
style 传下表第一列的值,写法和大小写都要完全一致,否则属于请求错误,param 为 style。不需要特别的风格时传 general。
style | 英文名 | 中文名 |
|---|---|---|
general | General | 通用 |
warm_ambient | Warm ambient | 暖调氛围 |
y2k_studio | Y2K studio | Y2K 影棚 |
swag_era | Swag era | Swag 年代 |
theatrical_light | Theatrical light | 戏剧光影 |
y2k_street | Y2K street | Y2K 街头 |
flash_editorial | Flash editorial | 闪光大片 |
old_smartphone | Old smartphone | 老手机 |
street_photography | Street photography | 街头摄影 |
retro_bw | Retro BW | 复古黑白 |
asian_nostalgia | Asian nostalgia | 亚洲怀旧 |
surreal_solarization | Surreal solarization | 超现实负感 |
subtle_flash | Subtle flash | 柔和闪光 |
digital_camera | Digital camera | 数码相机 |
siren | Siren | 海妖 |
mystique_city | Mystique city | 神秘都市 |
candy_pop | Candy pop | 糖果波普 |
double_exposure | Double exposure | 双重曝光 |
2000s_band | 2000s band | 2000 年代乐队 |
frutiger_aero | Frutiger aero | Frutiger Aero |
drain | Drain | Drain |
extraterrestrial | Extraterrestrial | 外星幻境 |
editorial_street_style | Editorial street style | 杂志街拍 |
nature_light | Nature light | 自然光 |
new_indie | New Indie | 新独立 |
underwater | Underwater | 水下 |
80s_horror | 80s horror | 80 年代恐怖 |
disposable_camera | Disposable camera | 一次性相机 |
neutral_pastel_film | Neutral pastel film | 中性粉彩胶片 |
warm_vivid_film | Warm vivid film | 暖调鲜艳胶片 |
bw_film | BW film | 黑白胶片 |
warm_contrast_film | Warm contrast film | 暖调高反差胶片 |
muted_cool_film | Muted cool film | 低饱和冷调胶片 |
什么时候换用其他模型
- 图里要有文字(文字容易乱码)、插画类强风格的图、按参考图改图:用 Nano Banana 2.1 或 GPT Image 2.6。
- 每次生成的人物都不一样。需要同一个人时,用 Nano Banana 2.1 或 GPT Image 2.6,每次传同一个人的参考照片。
价格
冻结 = 每张单价 × num_outputs
扣费 = 每张单价 × 生成出来的张数正在读取当前价格…
resolution(1.5k和2k同价)、aspect_ratio和style都不影响价格。- 未生成的图片的费用退回,见张数比请求的少。
当前单价见 GET /v1/products(prices 里每个分辨率一行,可以在提交前算出费用),以任务的 billing.frozen 为准;冻结和扣费规则见计费。
错误
请求错误
请求出错时返回 HTTP 错误,不会创建任务:
{
"code": 400,
"message": "Field required",
"error": {
"type": "invalid_request",
"param": "style",
"details": null
},
"request_id": "rq_01jb8z9x2c4v6b8n0m1q3w5e7r"
}| HTTP 状态码 | error.type | 说明 |
|---|---|---|
| 400 | invalid_request | 缺少必填参数、取值不符合参数表的要求(style 要与风格表完全一致),或传了不支持的参数;param 指出是哪个参数 |
| 401 | invalid_api_key | API Key 无效、已删除或已重置 |
| 402 | insufficient_balance | 可用余额为 0 |
| 402 | spend_limit_exceeded | API Key 的消费限额已用满 |
| 403 | account_suspended | 账号已停用 |
| 409 | idempotency_key_reused | 同一个 Idempotency-Key 用在了请求体不同的请求上 |
| 429 | rate_limited | 请求过于频繁 |
| 500 | internal_error | 服务端错误,任务可能已创建 |
details 字段和处理方式见创建任务 → 错误。
任务失败
任务创建后仍可能失败:status 变为 failed,原因在 error 中,没有 HTTP 状态码。失败的任务不扣费,已冻结的金额全额退回。
{
"status": "failed",
"error": {
"type": "content_policy",
"message": "The input was rejected by the content policy because it may contain NSFW content. Please change the input files or prompt."
}
}error.type | 说明 |
|---|---|
content_policy | 提示词或图片不符合内容政策(不适宜内容、受保护的肖像或版权内容):所有张都没生成出来且至少一张被审核拦下;只有部分被拦时任务仍成功,见张数比请求的少 |
insufficient_balance | 可用余额不足以支付本次费用 |
spend_limit_exceeded | 本次费用会超出 API Key 的消费限额 |
generation_failed | 生成失败 |
queue_timeout | 排队超过 30 分钟未开始 |
internal_error | 内部错误 |
程序判断请用 error.type;message 是面向开发者的英文说明,措辞可能调整。各原因的出现阶段、是否冻结过费用和 message 原文见失败原因。