Gemini 3.1 Flash Image
Generate or edit images through Frevana's Gemini image endpoint using gemini-3.1-flash-image.
Return the validated API response JSON unchanged. Treat generated_images[0].image_url (or data[0].image_url) as the primary image URL.
Model Characteristics
- Uses
gemini-3.1-flash-image.
- Best suited for fast iteration, social and creator content, prototypes, product workflows, and high-volume generation.
- For maximum detail, complex multi-object composition, or high-fidelity photorealism, route to
gemini-3-pro-image instead.
What This Skill Needs
- user-provided
prompt or contents
- optional reference image inputs:
--image, --image-url, --image-dir (up to 14 reference images, PNG/JPG/WebP, <50MB each)
- optional image settings:
--aspect-ratio, --image-size, --candidate-count, --system-instruction, --seed
- optional sampling settings (text-to-image only):
--temperature, --top-p, --top-k
- optional async execution / deduplication:
--job-id
- authentication:
FREVANA_API_KEY (or --api-key) / FREVANA_TOKEN (or --token)
- optional attribution:
FREVANA_AGENT_APP_INSTANCE_ID (or X_FREVANA_AGENT_APP_INSTANCE_ID, or --agent-app-instance-id) sent as x-frevana-agent-app-instance-id
curl, bash, and python3
Execution Order
- Confirm the user supplied an image prompt.
- If the user provides local reference images, map them to repeatable
--image.
- If the user provides remote reference URLs, map them to repeatable
--image-url.
- If the user points to an image directory, map it to repeatable
--image-dir.
- Enforce Gemini image editing rules:
- When reference images are present,
candidate_count supports 1 only.
- Text-to-image sampling parameters (
--temperature, --top-p, --top-k) are only allowed when no reference images are attached.
- The script reads
FREVANA_API_KEY / FREVANA_TOKEN from the environment, or CLI overrides --api-key / --token.
- When
FREVANA_AGENT_APP_INSTANCE_ID is set, the script attaches it as the x-frevana-agent-app-instance-id header.
- Return raw JSON, or extract
generated_images[0].image_url (or data[0].image_url) if the user only requested the URL.
- Save JSON with
--output when useful.
Allowed Options
--model: gemini-3.1-flash-image (default)
--aspect-ratio: 1:1, 1:4, 1:8, 2:3, 3:2, 3:4, 4:1, 4:3, 4:5, 5:4, 8:1, 9:16, 16:9, 21:9
--image-size: 1K, 2K, 4K (defaults to 1K)
--candidate-count, --n: 1-8 (image editing supports 1 only)
--system-instruction: system instruction prompt
--temperature: 0.0 - 2.0 (text-to-image only)
--top-p: 0.0 - 1.0 (text-to-image only)
--top-k: integer >= 1 (text-to-image only)
--seed: random seed integer for reproducible results
--job-id: client UUID for async generation and 7-day deduplication
--image: repeatable local file path (.png, .jpg, .jpeg, .webp), under 50MB
--image-url: repeatable remote HTTP(S) image; downloaded before upload, under 50MB
--image-dir: repeatable local directory, recursively searched for images; up to 14 total reference images
--api-key: Frevana API key override (sent as X-API-Key)
--token: Frevana Bearer token override (sent as Authorization: Bearer)
--agent-app-instance-id: Agent App instance/team ID override (sent as x-frevana-agent-app-instance-id)
--output: optional local path to save returned JSON
Commands
Text-to-Image Generation
bash <skill-path>/scripts/generate_image.sh \
--prompt "A vibrant futuristic city with neon lights and flying vehicles at dusk" \
--aspect-ratio 16:9 \
--image-size 2K \
--candidate-count 1 \
--temperature 1.0 \
--output ./out/gemini-flash-result.json
Image Editing / Reference-to-Image
bash <skill-path>/scripts/generate_image.sh \
--prompt "Change the background to a sunny beach while keeping the product style intact" \
--image ./refs/product.png \
--aspect-ratio 1:1 \
--image-size 1K \
--candidate-count 1 \
--output ./out/gemini-flash-edit-result.json
Response Shape
{
"generated_images": [
{
"image_url": "https://static.frevana.com/images/user-id/example-image-id.png",
"enhanced_prompt": "string",
"rai_filtered_reason": "string",
"mime_type": "image/png"
}
],
"credits_consumed": 1
}
Notes
- The backend route is
POST /gemini/image/generate.
- Keep
prompt required for both generation and editing.
- Up to 14 reference images are supported across
--image, --image-url, and --image-dir.
- When reference images are attached,
candidate_count must be 1, and --temperature, --top-p, --top-k are rejected.
- Do not rewrite or proxy returned Frevana image URLs unless requested.
1---2name: gemini-3-1-flash-image3description: Use when the user wants Frevana-hosted image generation or editing with Gemini 3.1 Flash Image (gemini-3.1-flash-image), optimized for fast iteration, high throughput, and multi-image editing.4metadata:5 source: https://skillmd.com/skills/finpeakinc/gemini-3-1-flash-image6---78# Gemini 3.1 Flash Image910Generate or edit images through Frevana's Gemini image endpoint using `gemini-3.1-flash-image`.1112Return the validated API response JSON unchanged. Treat `generated_images[0].image_url` (or `data[0].image_url`) as the primary image URL.1314## Model Characteristics1516- Uses `gemini-3.1-flash-image`.17- Best suited for fast iteration, social and creator content, prototypes, product workflows, and high-volume generation.18- For maximum detail, complex multi-object composition, or high-fidelity photorealism, route to `gemini-3-pro-image` instead.1920## What This Skill Needs2122- user-provided `prompt` or `contents`23- optional reference image inputs: `--image`, `--image-url`, `--image-dir` (up to 14 reference images, PNG/JPG/WebP, <50MB each)24- optional image settings: `--aspect-ratio`, `--image-size`, `--candidate-count`, `--system-instruction`, `--seed`25- optional sampling settings (text-to-image only): `--temperature`, `--top-p`, `--top-k`26- optional async execution / deduplication: `--job-id`27- authentication: `FREVANA_API_KEY` (or `--api-key`) / `FREVANA_TOKEN` (or `--token`)28- optional attribution: `FREVANA_AGENT_APP_INSTANCE_ID` (or `X_FREVANA_AGENT_APP_INSTANCE_ID`, or `--agent-app-instance-id`) sent as `x-frevana-agent-app-instance-id`29- `curl`, `bash`, and `python3`3031## Execution Order32331. Confirm the user supplied an image prompt.342. If the user provides local reference images, map them to repeatable `--image`.353. If the user provides remote reference URLs, map them to repeatable `--image-url`.364. If the user points to an image directory, map it to repeatable `--image-dir`.375. Enforce Gemini image editing rules:38 - When reference images are present, `candidate_count` supports `1` only.39 - Text-to-image sampling parameters (`--temperature`, `--top-p`, `--top-k`) are only allowed when no reference images are attached.406. The script reads `FREVANA_API_KEY` / `FREVANA_TOKEN` from the environment, or CLI overrides `--api-key` / `--token`.417. When `FREVANA_AGENT_APP_INSTANCE_ID` is set, the script attaches it as the `x-frevana-agent-app-instance-id` header.428. Return raw JSON, or extract `generated_images[0].image_url` (or `data[0].image_url`) if the user only requested the URL.439. Save JSON with `--output` when useful.4445## Allowed Options4647- `--model`: `gemini-3.1-flash-image` (default)48- `--aspect-ratio`: `1:1`, `1:4`, `1:8`, `2:3`, `3:2`, `3:4`, `4:1`, `4:3`, `4:5`, `5:4`, `8:1`, `9:16`, `16:9`, `21:9`49- `--image-size`: `1K`, `2K`, `4K` (defaults to `1K`)50- `--candidate-count`, `--n`: `1-8` (image editing supports `1` only)51- `--system-instruction`: system instruction prompt52- `--temperature`: `0.0 - 2.0` (text-to-image only)53- `--top-p`: `0.0 - 1.0` (text-to-image only)54- `--top-k`: integer `>= 1` (text-to-image only)55- `--seed`: random seed integer for reproducible results56- `--job-id`: client UUID for async generation and 7-day deduplication57- `--image`: repeatable local file path (`.png`, `.jpg`, `.jpeg`, `.webp`), under 50MB58- `--image-url`: repeatable remote HTTP(S) image; downloaded before upload, under 50MB59- `--image-dir`: repeatable local directory, recursively searched for images; up to 14 total reference images60- `--api-key`: Frevana API key override (sent as `X-API-Key`)61- `--token`: Frevana Bearer token override (sent as `Authorization: Bearer`)62- `--agent-app-instance-id`: Agent App instance/team ID override (sent as `x-frevana-agent-app-instance-id`)63- `--output`: optional local path to save returned JSON6465## Commands6667### Text-to-Image Generation6869```bash70bash <skill-path>/scripts/generate_image.sh \71 --prompt "A vibrant futuristic city with neon lights and flying vehicles at dusk" \72 --aspect-ratio 16:9 \73 --image-size 2K \74 --candidate-count 1 \75 --temperature 1.0 \76 --output ./out/gemini-flash-result.json77```7879### Image Editing / Reference-to-Image8081```bash82bash <skill-path>/scripts/generate_image.sh \83 --prompt "Change the background to a sunny beach while keeping the product style intact" \84 --image ./refs/product.png \85 --aspect-ratio 1:1 \86 --image-size 1K \87 --candidate-count 1 \88 --output ./out/gemini-flash-edit-result.json89```9091## Response Shape9293```json94{95 "generated_images": [96 {97 "image_url": "https://static.frevana.com/images/user-id/example-image-id.png",98 "enhanced_prompt": "string",99 "rai_filtered_reason": "string",100 "mime_type": "image/png"101 }102 ],103 "credits_consumed": 1104}105```106107## Notes108109- The backend route is `POST /gemini/image/generate`.110- Keep `prompt` required for both generation and editing.111- Up to 14 reference images are supported across `--image`, `--image-url`, and `--image-dir`.112- When reference images are attached, `candidate_count` must be 1, and `--temperature`, `--top-p`, `--top-k` are rejected.113- Do not rewrite or proxy returned Frevana image URLs unless requested.