Creative Studio API Docs

Reference for the Creative Studio REST API. No auth required for reads. Writes need an API key.
Authentication

Creative Studio runs in BYOK mode. Pass your Gemini API key via the X-API-Key header on every write request. We do not store your key. Costs are billed directly by Google.

curl -H "X-API-Key: YOUR_GEMINI_KEY" https://photogen.ashbi.ca/api/generate
Endpoints
GET/api/costs

Get total spend, per-model breakdown, per-day breakdown, and image count.

curl https://photogen.ashbi.ca/api/costs
POST/api/validate-key

Test whether a Gemini API key is valid before using it.

curl -X POST -H "X-API-Key: YOUR_KEY" https://photogen.ashbi.ca/api/validate-key
POST/api/generate

Generate a single image. Returns immediately with a job ID. Poll /api/jobs/<id> for the result.

curl -X POST -H "X-API-Key: YOUR_KEY"   -H "Content-Type: application/json"   -d '{"model": "gemini-3.1-flash-image-preview", "prompt": "A sleek bottle on marble", "ratio": "1:1", "product_image": "base64..."}'   https://photogen.ashbi.ca/api/generate
POST/api/composite

Composite a product image onto a generated background. Same async pattern as /generate.

curl -X POST -H "X-API-Key: YOUR_KEY"   -H "Content-Type: application/json"   -d '{"prompt": "On a beach at sunset", "product_image": "base64...", "ratio": "4:3"}'   https://photogen.ashbi.ca/api/composite
GET/api/jobs/<job_id>

Poll for job status. Returns running, done (with image URL + cost), or error.

curl https://photogen.ashbi.ca/api/jobs/job_abc123
GET/image/<path>

Serve a generated image. Paths are relative to the output directory.

Cost Table
ModelPrice / image
gemini-3.1-flash-image-preview (1K)$0.045
gemini-3.1-flash-image-preview (2K)$0.090
gemini-3-pro-image-preview (2K)$0.240
imagen-4.0-fast-generate-001$0.02
imagen-4.0-generate-001$0.04
imagen-4.0-ultra-generate-001$0.06