PrivateMind has an OpenAI-compatible endpoint that generates an image from a text prompt.
In Python, the PrivateMind SDK wraps this endpoint in one typed call: see Image generation in the Python SDK.
Generate an image
Send a model id, a prompt and a size to POST /v1/images/generations.
curl -s "https://api.privatemind.com/v1/images/generations" \
-H "Authorization: Bearer $PMIND_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "cosmos3-super-text2image",
"prompt": "a red panda on a mossy log in a misty forest at sunrise, photorealistic",
"size": "1024x1024"
}'model(required): an image model id. Image models havemodel_type: image-geninGET /v1/models. The aliast2ipoints to the text-to-image model.prompt(required): a description of the image to generate.size(required): the output resolution asWIDTHxHEIGHT, for example1024x1024. A missing or malformed value returns400.n(default1): number of images to generate.negative_prompt(optional): what to keep out of the image.num_inference_steps(default50): diffusion steps. Fewer is faster; more can refine detail.guidance_scale(default4.0): how strongly the image adheres to the prompt.seed(optional): set it for reproducible output; leave it out for a random image each call.response_format(defaultb64_json):urlis not supported.
Response
Each image comes back as a base64-encoded PNG in data[].b64_json, in OpenAI's images format:
{
"created": 1781481050,
"data": [
{ "b64_json": "iVBORw0KGgoAAAANSUhEUgAA..." }
]
}Decode it to a file:
import base64, json, requests, os
resp = requests.post(
"https://api.privatemind.com/v1/images/generations",
headers={"Authorization": f"Bearer {os.environ['PMIND_KEY']}"},
json={
"model": "cosmos3-super-text2image",
"prompt": "a red panda on a mossy log in a misty forest at sunrise, photorealistic",
"size": "1024x1024",
},
timeout=300,
)
resp.raise_for_status()
img = base64.b64decode(resp.json()["data"][0]["b64_json"])
open("out.png", "wb").write(img)Generation is synchronous: the request stays open until the image is ready. One 1024x1024 image usually takes a few seconds. More steps or a larger size take longer, so set a generous client timeout.
Content safety
Image models may apply a content-safety guardrail, which classifies unsafe content and blurs faces, before returning results. A prompt or image flagged as unsafe is rejected with an error.
Where next
- Models to list image-capable models in your org.
- Authentication for issuing and using API keys.
- Rate limits for budget and RPM behaviour.
- Errors for status codes and error shapes.