Image Generation
ShortGenius includes a powerful AI image generation feature. By providing a text prompt and specifying an aspect ratio (and optionally an image style), you can quickly create unique visuals for your projects. This section covers creating, listing, retrieving, and customizing images.
Creating Images
Endpoint: POST /images
Basic Example
import { ShortGenius } from 'shortgenius'
const client = new ShortGenius({
bearerAuth: 'YOUR_API_TOKEN'
})
const image = await client.createImage({
prompt: 'A futuristic cityscape at sunset',
aspectRatio: '9:16',
waitForGeneration: true
})
console.log(`Image created: ${image.id}`)
console.log(`URL: ${image.url}`)from shortgenius import Shortgenius
client = Shortgenius(api_key="YOUR_API_TOKEN")
image = client.images.create(
prompt="A futuristic cityscape at sunset",
aspect_ratio="9:16",
wait_for_generation=True
)
print(f"Image created: {image.id}")
print(f"URL: {image.url}")Key Fields:
prompt
string
Yes
Text prompt for image creation.
aspect_ratio
string
Yes
One of "9:16", "16:9", or "1:1".
image_style_id
string
No
An optional style preset. Retrieve available styles via GET /images/styles.
scene_id
string
No
If you want to attach this generated image to a particular video scene.
wait_for_generation
boolean
No
If false, the API returns immediately, and you must poll to see the final image. If true, it waits until the image is generated.
Sample Response (Synchronous)
If wait_for_generation is true, and generation succeeds quickly, you might get a response like:
If wait_for_generation is false, you might see state: "pending" or state: "generating", and you'll need to poll the GET endpoint until the state becomes "completed".
Retrieving Images
You can list all images you've generated or retrieve a single one by its ID.
List Images
Endpoint: GET /images
page
0
Results page number (zero-based)
limit
50
Items per page, up to 200
Retrieve a Single Image
Endpoint: GET /images/{id}
Image Styles
ShortGenius offers numerous image styles that apply artistic filters or aesthetic themes to your generated images. You can retrieve all available styles and use their IDs during image creation.
List Image Styles
Endpoint: GET /images/styles
You can use these IDs in the image_style_id field when creating images:
Attaching Images to Videos
While drafting or creating videos, you can include AI-generated images in the video scenes, by either:
Generating the image first, then embedding the
idorurlinto a scene.Specifying a
scene_idwhen callingPOST /images, so the platform automatically associates it.
Here's a simplified example of attaching an existing image to a video scene:
Next Steps
Now that you know how to generate and retrieve images, let's move on to Audio Generation (Text-to-Speech). You can create voiceovers or add TTS audio to your automated videos for a more immersive experience.
Last updated