Generate Image
Generate images from text descriptions using AI models.
POST
/v1/images/generateAPI KeyGenerate an image synchronously. Returns the image URL in the response.
Parameters
promptstringrequiredText description of the image to generatemodelstringModel ID (default: gemini-3.1-flash-image-preview)sizestringImage size: 1K, 2K, or 4Kaspect_ratiostringAspect ratio like 16:9, 1:1, 9:16Response
{
"id": "img_abc123",
"url": "https://cdn.picxstudio.com/generated/abc123.png",
"model": "gemini-3.1-flash-image-preview",
"size": "2K",
"credits_used": 12
}Examples
curl
curl -X POST https://api.picxstudio.com/v1/images/generate \
-H "Authorization: Bearer pxsk_your_key" \
-H "Content-Type: application/json" \
-d '{"prompt":"a cat on a windowsill, soft light","size":"2K","aspect_ratio":"16:9"}'python
import requests
resp = requests.post(
"https://api.picxstudio.com/v1/images/generate",
headers={"Authorization": "Bearer pxsk_your_key"},
json={"prompt": "a cat", "size": "2K"}
)
print(resp.json()["url"])