sfaie / text-to-image
Text to Image API
Generate images from a prompt with one POST.
AILive
Generate an image from a text prompt. POST the prompt, poll the generation by id, then download the output from the returned URL. Outputs are hosted on our CDN. The request body takes prompt and an optional aspect_ratio of 16:9, 9:16, 1:1, 4:3, or 3:4. The default is 1:1.
Endpoints
| Method | Path | Description |
|---|---|---|
| POST | /v1/sfaie/text-to-image | Create an image generation from a prompt. |
| GET | /v1/sfaie/text-to-image/generations/{id} | Fetch a generation and its output by id. |
Example
curl -X POST https://api.sfaie.com/v1/sfaie/text-to-image \
-H "x-api-key: $SFAIE_API_KEY" \
-H "content-type: application/json" \
-d '{"prompt": "a container ship at dawn, oil painting", "aspect_ratio": "16:9"}'{
"id": "gen_8f3kq0v2",
"status": "succeeded",
"output": {
"url": "https://cdn.sfaie.com/generations/gen_8f3kq0v2.png",
"content_type": "image/png"
}
}