GPT-Image-2
Generate or edit images through Frevana's AI Factory image API.
This skill returns the validated API response JSON unchanged. Treat data[0].image_url as the primary image URL.
What This Skill Needs
- user-provided
prompt or contents
- optional reference image inputs:
--image, --image-url, --image-dir, --mask
- optional Frevana image options:
n, size, quality, background, output_format, output_compression
FREVANA_TOKEN in the environment variables, or an explicit --token override for the current run
- optional
FREVANA_AGENT_APP_INSTANCE_ID; when non-empty, the script sends it as the x-frevana-agent-app-instance-id header on the image generation request
curl
bash
python3
Execution Order
- Confirm the user provided the image prompt.
- If the user references one or more local image files, pass each one with
--image.
- If the user references one or more remote image URLs, pass each one with
--image-url; the script downloads supported images first, then reuses the existing upload flow.
- If the user references a local directory of images, pass it with
--image-dir; the script recursively collects supported images from that directory.
- If the user provides a local mask image, pass it with
--mask and keep it PNG-only.
- Do not ask for or pass through image routing overrides; the Frevana script owns them.
- Prefer the script over ad hoc
curl commands.
- Let the script read
FREVANA_TOKEN first.
- When
FREVANA_AGENT_APP_INSTANCE_ID is non-empty, let the script attach it to the image generation request as x-frevana-agent-app-instance-id.
- In non-interactive runs, fail fast if the token is missing and tell the user to set
FREVANA_TOKEN or pass --token.
- Return the raw API response JSON, or the first image URL when the user only wants the hosted asset.
- Save the JSON with
--output when useful.
Allowed Options
--n: 1-10
--size: auto, 1024x1024, 1536x1024, 1024x1536, 256x256, 512x512, 1792x1024, 1024x1792
--quality: standard, hd, low, medium, high, auto
--background: opaque, auto
--output-format: png, jpeg, webp
--output-compression: 1-100
--image: repeatable local file path, .png/.jpg/.jpeg/.webp, each under 50MB
--image-url: repeatable remote http:// or https:// image URL; downloads supported .png/.jpg/.jpeg/.webp files first, each under 50MB
--image-dir: repeatable local directory path; recursively loads supported images, up to 16 images total across --image, --image-url, and --image-dir
--mask: optional local .png path, under 4MB, only when image inputs are present
Command
bash <skill-path>/scripts/generate_image.sh \
--prompt "A cinematic product photo of a matte black espresso machine on travertine" \
--size 1536x1024 \
--quality high \
--background opaque \
--output-format png \
--output ./out/gpt-image-2-result.json
bash <skill-path>/scripts/generate_image.sh \
--prompt "Turn these product references into one polished hero shot" \
--image ./refs/front.png \
--image-url "https://example.com/reference/detail.png" \
--image-dir ./refs/detail-shots \
--mask ./refs/mask.png \
--size 1024x1024 \
--output ./out/gpt-image-2-edit-result.json
Response Shape
{
"created": 1777367067,
"background": "opaque",
"output_format": "png",
"quality": "high",
"size": "1536x1024",
"data": [
{
"revised_prompt": "string",
"image_url": "https://static.frevana.com/images/user-id/example-image-id.png"
}
],
"credits_consumed": 1
}
Notes
- Do not pass image routing overrides; the wrapper rejects them.
- Do not pass
--background transparent; gpt-image-2 does not currently support transparent backgrounds.
- If the user says "use
/path/to/reference.png", map that to --image /path/to/reference.png.
- If the user says "use
https://example.com/reference.png", map that to --image-url https://example.com/reference.png.
- If the user says "use the images under
/path/to/references", map that to --image-dir /path/to/references.
- Keep
prompt/contents required even for image-to-image requests.
- Do not rewrite, proxy, or transform the returned Frevana image URLs unless the user asks for that.
1---2name: gpt-image-23description: Use when the user wants Frevana-hosted images generated or edited with gpt-image-2, including runs that use local or remote reference images or image directories.4---56# GPT-Image-278Generate or edit images through Frevana's AI Factory image API.910This skill returns the validated API response JSON unchanged. Treat `data[0].image_url` as the primary image URL.1112## What This Skill Needs1314- user-provided `prompt` or `contents`15- optional reference image inputs: `--image`, `--image-url`, `--image-dir`, `--mask`16- optional Frevana image options: `n`, `size`, `quality`, `background`, `output_format`, `output_compression`17- `FREVANA_TOKEN` in the environment variables, or an explicit `--token` override for the current run18- optional `FREVANA_AGENT_APP_INSTANCE_ID`; when non-empty, the script sends it as the `x-frevana-agent-app-instance-id` header on the image generation request19- `curl`20- `bash`21- `python3`2223## Execution Order24251. Confirm the user provided the image prompt.262. If the user references one or more local image files, pass each one with `--image`.273. If the user references one or more remote image URLs, pass each one with `--image-url`; the script downloads supported images first, then reuses the existing upload flow.284. If the user references a local directory of images, pass it with `--image-dir`; the script recursively collects supported images from that directory.295. If the user provides a local mask image, pass it with `--mask` and keep it PNG-only.306. Do not ask for or pass through image routing overrides; the Frevana script owns them.317. Prefer the script over ad hoc `curl` commands.328. Let the script read `FREVANA_TOKEN` first.339. When `FREVANA_AGENT_APP_INSTANCE_ID` is non-empty, let the script attach it to the image generation request as `x-frevana-agent-app-instance-id`.3410. In non-interactive runs, fail fast if the token is missing and tell the user to set `FREVANA_TOKEN` or pass `--token`.3511. Return the raw API response JSON, or the first image URL when the user only wants the hosted asset.3612. Save the JSON with `--output` when useful.3738## Allowed Options3940- `--n`: `1-10`41- `--size`: `auto`, `1024x1024`, `1536x1024`, `1024x1536`, `256x256`, `512x512`, `1792x1024`, `1024x1792`42- `--quality`: `standard`, `hd`, `low`, `medium`, `high`, `auto`43- `--background`: `opaque`, `auto`44- `--output-format`: `png`, `jpeg`, `webp`45- `--output-compression`: `1-100`46- `--image`: repeatable local file path, `.png`/`.jpg`/`.jpeg`/`.webp`, each under 50MB47- `--image-url`: repeatable remote `http://` or `https://` image URL; downloads supported `.png`/`.jpg`/`.jpeg`/`.webp` files first, each under 50MB48- `--image-dir`: repeatable local directory path; recursively loads supported images, up to 16 images total across `--image`, `--image-url`, and `--image-dir`49- `--mask`: optional local `.png` path, under 4MB, only when image inputs are present5051## Command5253```bash54bash <skill-path>/scripts/generate_image.sh \55 --prompt "A cinematic product photo of a matte black espresso machine on travertine" \56 --size 1536x1024 \57 --quality high \58 --background opaque \59 --output-format png \60 --output ./out/gpt-image-2-result.json6162bash <skill-path>/scripts/generate_image.sh \63 --prompt "Turn these product references into one polished hero shot" \64 --image ./refs/front.png \65 --image-url "https://example.com/reference/detail.png" \66 --image-dir ./refs/detail-shots \67 --mask ./refs/mask.png \68 --size 1024x1024 \69 --output ./out/gpt-image-2-edit-result.json70```7172## Response Shape7374```json75{76 "created": 1777367067,77 "background": "opaque",78 "output_format": "png",79 "quality": "high",80 "size": "1536x1024",81 "data": [82 {83 "revised_prompt": "string",84 "image_url": "https://static.frevana.com/images/user-id/example-image-id.png"85 }86 ],87 "credits_consumed": 188}89```9091## Notes9293- Do not pass image routing overrides; the wrapper rejects them.94- Do not pass `--background transparent`; `gpt-image-2` does not currently support transparent backgrounds.95- If the user says "use `/path/to/reference.png`", map that to `--image /path/to/reference.png`.96- If the user says "use `https://example.com/reference.png`", map that to `--image-url https://example.com/reference.png`.97- If the user says "use the images under `/path/to/references`", map that to `--image-dir /path/to/references`.98- Keep `prompt`/`contents` required even for image-to-image requests.99- Do not rewrite, proxy, or transform the returned Frevana image URLs unless the user asks for that.