Get API key

Text to image

OpenAI-compatible endpoint for generating images from a text prompt.

PrivateMind exposes an OpenAI-compatible image-generation endpoint. Image models generate an image from a text prompt.

Generate an image

POST /v1/images/generations returns an image generated from a text prompt.

cURL
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): image model id. List with GET /v1/models (type image-gen). The alias t2i also resolves to this model.
  • prompt (required): text description of the image to generate.
  • size (required): output resolution as WIDTHxHEIGHT (e.g. 1024x1024). A missing or malformed value is rejected with a 400.
  • n (default 1): number of images to generate.
  • negative_prompt (optional): text describing what to avoid in the image.
  • num_inference_steps (default 50): diffusion steps. Fewer is faster; more can refine detail.
  • guidance_scale (default 4.0): how strongly the image adheres to the prompt.
  • seed (optional): fix for reproducible output. Omit for a random image each call.
  • response_format (default b64_json): b64_json returns the image inline as base64; url is not supported.

Response

The response follows the OpenAI images shape. The image is returned inline as base64-encoded PNG under data[].b64_json:

JSON
{
  "created": 1781481050,
  "data": [
    { "b64_json": "iVBORw0KGgoAAAANSUhEUgAA..." }
  ]
}

Decode it to a file:

Python
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)

Content safety

Image models may apply a content-safety guardrail (unsafe-content classification and face blurring) before returning results. Prompts or outputs flagged as unsafe are rejected with an error.

Where next