跳转到主要内容
POST
/
bria
/
text-to-image
Generate Bria images
curl --request POST \
  --url https://api.cometapi.com/bria/text-to-image \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "prompt": "A paper boat floating on calm water at sunrise."
}
'
{
  "result": [
    {
      "urls": [
        "https://example.com/generated.png"
      ],
      "seed": 278741175,
      "uuid": "27c39b06-1dfe-11f1-ad57-6ac2c454c04d_278741175"
    }
  ]
}
通过纯文本 Prompt 生成可安全用于商业场景的图像。对于在 CometAPI 上的首次请求,请发送 prompt,将 num_results 保持为 1,并以 aspect_ratio: "1:1" 开始,除非你已经明确知道所需的最终布局。

适合在以下情况使用此路由

  • 你希望通过一次调用获得最终图像
  • 你不需要蒙版、图像输入或任务轮询
  • 你希望使用一个更易于通过 CometAPI 落地的、照片级真实的 Bria 路径

从这个请求开始

  • 保持 Prompt 简短且具体
  • 首次冒烟测试使用 num_results: 1
  • aspect_ratio: "1:1" 开始,除非目标布局已经确定
  • 如果你需要长期保留,请及时下载返回的 URL

CometAPI 上的响应行为

Bria 的官方文档描述了更完整的生成流程,并讨论了异步状态流。在 CometAPI 上,此路由使用简化的 JSON 请求,并且在当前的冒烟测试中,会立即返回最终的 result 数组,而不是返回 request_idstatus_url
CometAPI 代理的是 Bria 的能力,而不是逐字段镜像 Bria 的公开 API。集成时,请以本页 API 参考和 Playground 中展示的请求与响应结构为准。

授权

Authorization
string
header
必填

Bearer token authentication. Use your CometAPI key.

请求体

application/json
prompt
string
必填

English text prompt for image generation.

示例:

"A paper boat floating on calm water at sunrise."

num_results
integer
默认值:1

Number of images to generate. Use 1 for the simplest integration test.

aspect_ratio
enum<string>
默认值:1:1

Requested output aspect ratio.

可用选项:
1:1,
2:3,
3:2,
3:4,
4:3,
4:5,
5:4,
9:16,
16:9
seed
integer

Optional seed for reproducible results.

negative_prompt
string

Optional exclusions for the generated image.

steps_num
integer
默认值:30

Optional refinement step count.

text_guidance_scale
integer
默认值:5

Optional prompt adherence setting.

medium
enum<string>

Optional visual medium.

可用选项:
photography,
art
prompt_enhancement
boolean
默认值:false

Optional prompt enhancement switch.

enhance_image
boolean
默认值:false

Optional image detail enhancement switch.

prompt_content_moderation
boolean
默认值:false

Optional moderation switch.

ip_signal
boolean
默认值:false

Optional IP warning flag.

sync
boolean
默认值:false

Optional sync hint. Current CometAPI smoke tests returned final results immediately without setting this field.

响应

200 - application/json

Image generation result.

result
object[]
必填