Ideogram AI
AcceleAI 集成了 Ideogram 的图像生成 API,支持 V3 和 V2/V1 两代接口。Ideogram 擅长文字渲染、设计排版类图像生成,同时支持图生图、局部编辑、背景替换等高级功能。
V3 API
定价
| 速度档位 | 生成 | Remix | 编辑 | 背景替换 |
|---|---|---|---|---|
| Turbo | $0.03 | $0.03 | $0.06 | $0.06 |
| Default | $0.06 | $0.06 | $0.06 | $0.06 |
| Quality | $0.09 | $0.09 | $0.09 | $0.09 |
V3 文生图(Generate)
端点: POST https://api.acceleai.cn/ideogram/v1/ideogram-v3/generate
| 参数 | 类型 | 默认值 | 说明 |
|---|---|---|---|
prompt | string | 必填 | 图像描述 |
rendering_speed | string | DEFAULT | TURBO / DEFAULT / QUALITY |
num_images | integer | 1 | 生成数量,1-8 |
aspect_ratio | string | 1x1 | 支持 15 种比例,如 16x9、9x16、2x3、3x2 等 |
magic_prompt | string | AUTO | 提示词增强:AUTO / ON / OFF |
style_type | string | AUTO | 风格:AUTO / GENERAL / REALISTIC / DESIGN |
negative_prompt | string | - | 排除内容描述 |
seed | integer | - | 随机种子,0-2147483647 |
style_reference_images | file | - | 风格参考图 |
import requests
data = {
"prompt": "精致的 3D 封面设计,未来城市中的战斗机甲",
"rendering_speed": "QUALITY",
"num_images": "2",
"aspect_ratio": "2x1",
"magic_prompt": "AUTO",
"style_type": "AUTO",
"negative_prompt": "blurry, watermark"
}
files = {}
for key, value in data.items():
files[key] = (None, str(value))
response = requests.post(
"https://api.acceleai.cn/ideogram/v1/ideogram-v3/generate",
headers={"Api-Key": "<ACCELE_AI_API_KEY>"},
files=files
)
print(response.json())V3 Remix
基于参考图和新提示词重新生成图像,保留原图的风格或内容特征。
端点: POST https://api.acceleai.cn/ideogram/v1/ideogram-v3/remix
额外参数:
| 参数 | 类型 | 默认值 | 说明 |
|---|---|---|---|
image | file | 必填 | 原始参考图 |
image_weight | integer | 50 | 原图保留权重,1-100(越高越贴近原图) |
import requests
with open("reference.jpg", "rb") as img:
response = requests.post(
"https://api.acceleai.cn/ideogram/v1/ideogram-v3/remix",
headers={"Api-Key": "<ACCELE_AI_API_KEY>"},
data={
"prompt": "将场景转换为赛博朋克风格",
"rendering_speed": "DEFAULT",
"image_weight": 60,
"num_images": 1,
},
files={"image": img}
)
print(response.json())V3 编辑(Edit)
通过遮罩(Mask)对图像进行局部编辑,黑色区域为待编辑区域,白色区域保持不变。
端点: POST https://api.acceleai.cn/ideogram/v1/ideogram-v3/edit
额外参数:
| 参数 | 类型 | 说明 |
|---|---|---|
image | file | 必填,原始图像 |
mask | file | 必填,编辑遮罩图 |
import requests
with open("image.jpg", "rb") as img, open("mask.jpg", "rb") as mask:
response = requests.post(
"https://api.acceleai.cn/ideogram/v1/ideogram-v3/edit",
headers={"Api-Key": "<ACCELE_AI_API_KEY>"},
data={
"prompt": "移除图片中的文字",
"rendering_speed": "DEFAULT",
"num_images": 1,
},
files={"image": img, "mask": mask}
)
print(response.json())V3 背景替换(Replace Background)
智能识别前景物体,并替换为提示词描述的新背景。
端点: POST https://api.acceleai.cn/ideogram/v1/ideogram-v3/replace-background
| 参数 | 类型 | 说明 |
|---|---|---|
prompt | string | 必填,新背景描述 |
image | file | 必填,原始图像 |
背景替换接口不支持
aspect_ratio和negative_prompt参数。
import requests
with open("product.jpg", "rb") as img:
response = requests.post(
"https://api.acceleai.cn/ideogram/v1/ideogram-v3/replace-background",
headers={"Api-Key": "<ACCELE_AI_API_KEY>"},
data={
"prompt": "clean white studio background with soft lighting",
"rendering_speed": "DEFAULT",
},
files={"image": img}
)
print(response.json())V2 / V1 API
定价
图像生成:
| 模型 | 单张价格 |
|---|---|
| V_2 | $0.08 |
| V_2_TURBO | $0.05 |
| V_2A | $0.04 |
| V_2A_TURBO | $0.025 |
| V_1 | $0.06 |
| V_1_TURBO | $0.02 |
图像编辑:
| 模型 | 单张价格 |
|---|---|
| V_2 Edit | $0.08 |
| V_2_TURBO Edit | $0.05 |
图像放大: $0.06 / 张
V2 文生图(Generate)
端点: POST https://api.acceleai.cn/ideogram/generate
import requests
import os
response = requests.post(
"https://api.acceleai.cn/ideogram/generate",
headers={
"Api-Key": os.getenv("ACCELEAI_API_KEY"),
"Content-Type": "application/json"
},
json={
"image_request": {
"prompt": "可爱的白色猫头鹰幼崽与蘑菇,3D 渲染风格",
"negative_prompt": "blurry, bad anatomy, watermark",
"aspect_ratio": "ASPECT_3_2",
"model": "V_2",
"num_images": 2,
"magic_prompt_option": "AUTO",
"style_type": "RENDER_3D"
}
}
)
print(response.json())V2 支持的风格类型:AUTO、GENERAL、REALISTIC、DESIGN、RENDER_3D、ANIME。
V2 宽高比格式为 ASPECT_1_1、ASPECT_16_9、ASPECT_9_16 等(与 V3 的 1x1、16x9 格式不同)。
V2 编辑(Edit)
仅 V_2 和 V_2_TURBO 支持编辑功能。遮罩要求:黑色为编辑区域,白色为保留区域,编辑区域需至少占 10%。
端点: POST https://api.acceleai.cn/ideogram/edit
import requests
import os
files = {
"image_file": open("source.jpg", "rb"),
"mask": open("mask.jpg", "rb")
}
response = requests.post(
"https://api.acceleai.cn/ideogram/edit",
headers={"Api-Key": os.getenv("ACCELEAI_API_KEY")},
data={
"prompt": "替换为森林场景",
"model": "V_2",
"magic_prompt_option": "AUTO",
"num_images": 1,
"style_type": "REALISTIC"
},
files=files
)
print(response.json())V2 Remix
将参考图与新提示词混合生成变体图像。
端点: POST https://api.acceleai.cn/ideogram/remix
import requests
import os
files = {"image_file": open("reference.jpg", "rb")}
payload = {
"image_request": '{"prompt": "watercolor painting style", "aspect_ratio": "ASPECT_10_16", "image_weight": 50, "magic_prompt_option": "ON", "model": "V_2"}'
}
response = requests.post(
"https://api.acceleai.cn/ideogram/remix",
headers={"Api-Key": os.getenv("ACCELEAI_API_KEY")},
data=payload,
files=files
)
print(response.json())V2 图像放大(Upscale)
将图像放大至 2 倍分辨率,可通过参数控制细节增强程度。
端点: POST https://api.acceleai.cn/ideogram/upscale
参数说明:resemblance(相似度,1-100)和 detail(细节程度,1-100),默认均为 50。
import requests
import os
files = {"image_file": open("image.jpg", "rb")}
payload = {"image_request": "{}"}
response = requests.post(
"https://api.acceleai.cn/ideogram/upscale",
headers={"Api-Key": os.getenv("ACCELEAI_API_KEY")},
data=payload,
files=files
)
print(response.json())V2 图像描述(Describe)
上传图像,返回该图像的文本描述(逆向提示词工程)。
端点: POST https://api.acceleai.cn/ideogram/describe
import requests
import os
files = {"image_file": open("image.jpg", "rb")}
response = requests.post(
"https://api.acceleai.cn/ideogram/describe",
headers={"Api-Key": os.getenv("ACCELEAI_API_KEY")},
files=files
)
print(response.json())
# 返回格式:{"descriptions": [{"text": "图像描述..."}]}返回格式
所有生成接口的标准返回格式:
{
"created": "2025-01-01T00:00:00Z",
"data": [
{
"prompt": "处理后的提示词",
"resolution": "1024x1024",
"is_image_safe": true,
"seed": 12345,
"url": "https://ideogram.ai/api/images/direct/...",
"style_type": "REALISTIC"
}
]
}V3 与 V2 的主要差异
| 方面 | V3 | V2 / V1 |
|---|---|---|
| 宽高比格式 | 1x1、2x1 等 | ASPECT_1_1、ASPECT_2_1 等 |
| 风格类型 | AUTO / GENERAL / REALISTIC / DESIGN | 额外支持 RENDER_3D / ANIME |
| 速度控制 | TURBO / DEFAULT / QUALITY | 通过模型后缀选择(V_2_TURBO) |
| 编辑 / 背景替换 | 原生支持 | 仅 V2 支持编辑 |
| 请求格式 | multipart/form-data | JSON + multipart 混合 |