ima2-gen 2.0.4 → 2.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/README.md +6 -2
  2. package/bin/commands/video.js +26 -11
  3. package/docs/API.md +91 -5
  4. package/docs/CLI.md +8 -7
  5. package/docs/README.ja.md +86 -8
  6. package/docs/README.ko.md +31 -16
  7. package/docs/README.zh-CN.md +84 -9
  8. package/docs/migration/runtime-test-inventory.md +4 -1
  9. package/lib/agentGenerationPlanner.js +2 -2
  10. package/lib/agentImageVideoGen.js +19 -2
  11. package/lib/agentPlannerModel.js +1 -1
  12. package/lib/agentToolManifest.js +2 -2
  13. package/lib/capabilities.js +4 -2
  14. package/lib/grokVideoAdapter.js +22 -11
  15. package/lib/grokVideoCanvas.js +1 -1
  16. package/lib/imageModels.js +31 -4
  17. package/package.json +2 -1
  18. package/routes/video.js +6 -1
  19. package/skills/ima2/SKILL.md +6 -6
  20. package/ui/dist/.vite/manifest.json +12 -12
  21. package/ui/dist/assets/{AgentWorkspace-CMP9XZrL.js → AgentWorkspace-CKjpho46.js} +1 -1
  22. package/ui/dist/assets/{CardNewsWorkspace-DtOwgYzf.js → CardNewsWorkspace-BW52bztP.js} +1 -1
  23. package/ui/dist/assets/{GenerationRequestLogPanel-CB1i5dWd.js → GenerationRequestLogPanel-BPc4gDcY.js} +1 -1
  24. package/ui/dist/assets/{NodeCanvas-DwX2jRHf.js → NodeCanvas-d7dH6h99.js} +1 -1
  25. package/ui/dist/assets/{PromptBuilderPanel-B3VhUc5u.js → PromptBuilderPanel-CWbdfzpF.js} +1 -1
  26. package/ui/dist/assets/{PromptImportDialog-4FQd2YVS.js → PromptImportDialog-DORdifOt.js} +2 -2
  27. package/ui/dist/assets/{PromptImportDiscoverySection-CTNr6ft3.js → PromptImportDiscoverySection-XA3ZzwAo.js} +1 -1
  28. package/ui/dist/assets/{PromptImportFolderSection-zCJ1lBH8.js → PromptImportFolderSection-BjALahD0.js} +1 -1
  29. package/ui/dist/assets/{PromptLibraryPanel-B784T1KR.js → PromptLibraryPanel-Co9xIawD.js} +2 -2
  30. package/ui/dist/assets/{SettingsWorkspace-BpM6lWH-.js → SettingsWorkspace-BS_gSTTl.js} +1 -1
  31. package/ui/dist/assets/index-TRRNueAb.js +23 -0
  32. package/ui/dist/assets/{index-CwAzer33.js → index-bMxZBOnc.js} +1 -1
  33. package/ui/dist/index.html +1 -1
  34. package/ui/dist/assets/index-BzjrmmIG.js +0 -23
package/README.md CHANGED
@@ -16,7 +16,7 @@
16
16
 
17
17
  `ima2-gen` is a local image generation studio for people who want the ChatGPT/Codex image workflow in a small desktop-like web app.
18
18
 
19
- Install globally, sign in with ChatGPT OAuth or Grok OAuth, and start generating images and videos. Iterate with history, references, node branches, multimode batches, Canvas Mode cleanup, and Grok Video generation. No API key required free ChatGPT OAuth and SuperGrok subscription cover everything.
19
+ Install globally, sign in with ChatGPT OAuth or Grok OAuth, and start generating images and videos. Iterate with history, references, node branches, multimode batches, Canvas Mode cleanup, and Grok Video generation. Default OAuth paths need no API key; optional API-key providers (`api`, `grok-api`, `gemini-api`, `agy`) are also supported.
20
20
 
21
21
  ![ima2-gen video playback with gallery sidebar showing generated images and videos.](assets/screenshots/classic-generate-light.png)
22
22
 
@@ -108,6 +108,7 @@ Image generation can run through the local Codex/ChatGPT OAuth path, a configure
108
108
  - `provider: "oauth"` uses the local Codex OAuth proxy.
109
109
  - `provider: "api"` calls the OpenAI Responses API with the hosted `image_generation` tool.
110
110
  - `provider: "grok"` starts bundled `progrok` on `127.0.0.1:18645`, runs mandatory xAI Web Search plus a planner pass (default: `grok-4.3`, configurable in settings or via `--planner-model`), then calls xAI Images API through the local proxy.
111
+ - `provider: "grok-api"` calls the xAI Images API directly with `XAI_API_KEY` (no bundled progrok OAuth proxy).
111
112
  - `provider: "agy"` spawns the Antigravity CLI (`agy -p`) to generate images via Google Gemini's `default_api:generate_image` tool (model: `nano-banana-2`). Output is fixed at 1024×1024 JPEG, max 3 reference images. No web search, quality, or size controls.
112
113
  - `provider: "gemini-api"` calls the Google Generative Language API directly. Supports two models: `nano-banana-2` (Gemini 3.1 Flash Image) and `nano-banana-pro` (Gemini 3 Pro Image). Auth is via `GEMINI_API_KEY` env var, web UI key management, or a Vertex AI service account JSON (`VERTEX_SERVICE_ACCOUNT_JSON`). When both an API key and Vertex credentials are configured, Vertex takes priority. Supports variable aspect ratios (1:1 through 21:9) and four resolution tiers (512px, 1K, 2K, 4K); these controls are only honored on the direct API path — the Vertex AI endpoint ignores aspect/size because it does not accept the `response_format` field. Per-model cost differs: `nano-banana-2` (Flash): 512=$0.001, 1K=$0.003, 2K=$0.004, 4K=$0.006; `nano-banana-pro`: 1K=$0.007, 2K=$0.007, 4K=$0.013. No web search or mask controls.
113
114
  - API-key generation supports classic generate, edit, mask-guided edit, multimode, and node generation.
@@ -117,7 +118,7 @@ If no provider is specified, the app keeps the current GPT OAuth/default behavio
117
118
 
118
119
  Grok image generation exposes a model picker (`grok-imagine-image` / `grok-imagine-image-quality`) and a size picker (aspect ratio + 1k/2k resolution). The Settings page shows a billing/quota bar with `$used/$limit` drawn from the Grok billing API, and a **Switch Account** button that starts a device-code OAuth flow (`POST /api/auth/switch`) for re-authenticating without leaving the app.
119
120
 
120
- Grok video generation uses `grok-imagine-video` (default) or `grok-imagine-video-1.5-preview`. Three modes are auto-detected from reference count: text-to-video (0 refs), image-to-video (1 ref), and reference-to-video (27 refs, max 10s duration). `grok-imagine-video-1.5-preview` supports image-to-video but not `reference_images` Ref2V, so 2+ refs use `grok-imagine-video` as the effective model. Video edit and extension are also base-model only. Video controls include duration (115s), resolution (480p, 720p), and aspect ratio (1:1, 16:9, 9:16, 4:3, 3:4, 3:2, 2:3, auto).
121
+ Grok video generation uses `grok-imagine-video` (default) or canonical `grok-imagine-video-1.5`; the legacy `grok-imagine-video-1.5-preview` string is accepted as an alias. Three modes are auto-detected from reference count: text-to-video (0 refs), image-to-video (1 ref), and reference-to-video (2-7 refs, max 10s duration). 1080p is available for `grok-imagine-video-1.5` prompt-only text-to-video and single image/frame image-to-video; prompt-only 1.5 uses the internal white-canvas I2V shim before the upstream request. 1.5 does not add `reference_images` Ref2V, V2V edit, or extension support, so those paths remain base-model only. Video controls include duration (1-15s), resolution (480p, 720p, 1080p when supported), and aspect ratio (1:1, 16:9, 9:16, 4:3, 3:4, 3:2, 2:3, auto).
121
122
 
122
123
  ![Settings workspace showing GPT OAuth active and API key provider available.](assets/screenshots/settings-oauth-generation.png)
123
124
 
@@ -255,6 +256,7 @@ environment variables > ~/.ima2/config.json > built-in defaults
255
256
  | `IMA2_LOG_LEVEL` | `info` | Normal serve defaults to `info`; dev mode defaults to `debug`; supports `debug`, `info`, `warn`, `error`, or `silent` |
256
257
  | `IMA2_INFLIGHT_TERMINAL_TTL_MS` | `300000` | Recent terminal job retention for debug views |
257
258
  | `OPENAI_API_KEY` | — | API key for the `provider: "api"` Responses API image path and auxiliary API-key features |
259
+ | `XAI_API_KEY` | — | API key for `provider: "grok-api"` direct xAI Images API path |
258
260
  | `IMA2_API_IMAGE_MODEL_DEFAULT` | `gpt-5.4-mini` | Default image model for `provider: "api"` |
259
261
  | `IMA2_API_REASONING_EFFORT` | `low` | Default reasoning effort for `provider: "api"` |
260
262
  | `IMA2_API_IMAGE_SIZE` | `1024x1024` | Default size for `provider: "api"` |
@@ -269,6 +271,8 @@ environment variables > ~/.ima2/config.json > built-in defaults
269
271
  | `IMA2_OAUTH_MASKED_EDIT_ENABLED` | `false` | Opt-in feature flag for masked-edit requests on the OAuth path (#31, groundwork only) |
270
272
  | `GEMINI_API_KEY` | — | API key for `provider: "gemini-api"` direct Generative Language API path |
271
273
  | `VERTEX_SERVICE_ACCOUNT_JSON` | — | Google service account JSON for Vertex AI auth with `provider: "gemini-api"`; takes priority over `GEMINI_API_KEY` when both are set |
274
+ | `IMA2_AGY_BIN` | `agy` on PATH | Explicit path to the Antigravity CLI binary for `provider: "agy"` |
275
+ | `IMA2_MAX_PARALLEL` | `24` | Server-wide parallel generation cap |
272
276
 
273
277
  ### Logging modes
274
278
 
@@ -5,10 +5,21 @@ import { out, die, color, json, exitCodeForError } from "../lib/output.js";
5
5
  import { config } from "../../config.js";
6
6
  import { readFile, writeFile, mkdir } from "node:fs/promises";
7
7
  import { basename, dirname, join } from "node:path";
8
- const VALID_RESOLUTIONS = new Set(["480p", "720p"]);
8
+ import { deriveVideoMode, GROK_VIDEO_MODEL_15, GROK_VIDEO_MODEL_15_PREVIEW_ALIAS, GROK_VIDEO_MODEL_BASE, validateVideoResolutionForRequest, } from "../../lib/imageModels.js";
9
+ const VALID_RESOLUTIONS = new Set(["480p", "720p", "1080p"]);
9
10
  const VALID_ASPECT_RATIOS = new Set(["1:1", "16:9", "9:16", "4:3", "3:4", "3:2", "2:3", "auto"]);
10
- const VALID_MODELS = new Set(["grok-imagine-video", "grok-imagine-video-1.5-preview"]);
11
+ const VALID_MODELS = new Set([GROK_VIDEO_MODEL_BASE, GROK_VIDEO_MODEL_15, GROK_VIDEO_MODEL_15_PREVIEW_ALIAS]);
11
12
  const ACTIVE_VIDEO_PROMPT_GUIDANCE = "Active video prompt required: describe visual flow, motion flow, sound/no-music intent, dialogue/no-dialogue intent, and the desired ending frame. Pace the scene to naturally fill the selected duration with an opening composition, connected motion/emotion change, and stable ending frame.";
13
+ function canonicalVideoModel(model) {
14
+ return model === GROK_VIDEO_MODEL_15_PREVIEW_ALIAS ? GROK_VIDEO_MODEL_15 : model;
15
+ }
16
+ function validateCliVideoResolution(model, resolution, mode) {
17
+ const check = validateVideoResolutionForRequest(canonicalVideoModel(model), resolution, mode, {
18
+ allowTextCanvasShim: true,
19
+ });
20
+ if (!("ok" in check))
21
+ die(2, check.error);
22
+ }
12
23
  function parseIntegerFlag(value, fallback, label) {
13
24
  const raw = value === undefined ? String(fallback) : String(value);
14
25
  if (!/^\d+$/.test(raw))
@@ -91,9 +102,9 @@ const HELP = `
91
102
 
92
103
  Options (generate mode):
93
104
  --duration <1..15> Duration in seconds. Default: 5. Prompt motion should naturally fill this length
94
- --resolution <480p|720p> Default: 480p
105
+ --resolution <480p|720p|1080p> Default: 480p. 1080p requires --model grok-imagine-video-1.5; prompt-only uses a white-canvas I2V shim
95
106
  --aspect-ratio <ratio|auto> 1:1, 16:9, 9:16, 4:3, 3:4, 3:2, 2:3, auto. Default: auto
96
- --model <name> grok-imagine-video, grok-imagine-video-1.5-preview
107
+ --model <name> grok-imagine-video, grok-imagine-video-1.5 (preview alias accepted)
97
108
  --planner-model <name> Planner model override (e.g. grok-4.3, gpt-5.5)
98
109
  --storyboard Enable storyboard mode (maintains character/scene continuity)
99
110
  --topic <text> Series topic for prompt chain continuity
@@ -149,18 +160,20 @@ export default async function videoCmd(argv) {
149
160
  die(2, "--duration must be between 1 and 15");
150
161
  const resolution = String(args.resolution);
151
162
  if (!VALID_RESOLUTIONS.has(resolution))
152
- die(2, "--resolution must be one of: 480p, 720p");
163
+ die(2, "--resolution must be one of: 480p, 720p, 1080p");
153
164
  const aspectRatio = String(args["aspect-ratio"]);
154
165
  if (!VALID_ASPECT_RATIOS.has(aspectRatio))
155
166
  die(2, "--aspect-ratio must be one of: 1:1, 16:9, 9:16, 4:3, 3:4, 3:2, 2:3, auto");
156
167
  if (args.model && !VALID_MODELS.has(String(args.model))) {
157
- die(2, "--model must be one of: grok-imagine-video, grok-imagine-video-1.5-preview");
168
+ die(2, "--model must be one of: grok-imagine-video, grok-imagine-video-1.5");
158
169
  }
170
+ const model = args.model ? canonicalVideoModel(String(args.model)) : GROK_VIDEO_MODEL_BASE;
159
171
  const refs = (Array.isArray(args.ref) ? args.ref : []);
160
172
  if (refs.length > 7)
161
173
  die(2, "max 7 --ref attachments for video");
162
174
  if (refs.length >= 2 && duration > 10)
163
175
  die(2, "--duration must be between 1 and 10 when using 2 or more --ref attachments");
176
+ validateCliVideoResolution(model, resolution, deriveVideoMode(refs.length));
164
177
  const timeoutSeconds = parseIntegerFlag(args.timeout, 600, "--timeout");
165
178
  if (timeoutSeconds < 1)
166
179
  die(2, "--timeout must be at least 1");
@@ -187,7 +200,7 @@ export default async function videoCmd(argv) {
187
200
  requestId,
188
201
  };
189
202
  if (args.model)
190
- body.model = args.model;
203
+ body.model = model;
191
204
  if (args["planner-model"])
192
205
  body.plannerModel = args["planner-model"];
193
206
  if (args.storyboard)
@@ -429,7 +442,7 @@ async function videoContinueCmd(argv) {
429
442
  const args = parseArgs(argv, spec);
430
443
  rejectUnknownFlags(args);
431
444
  if (args.help) {
432
- out(` ima2 video continue <prompt> --video <generated-file>\n\n Generate a new clip from a generated video's last frame and carry branch-local revisedPrompt lineage.\n\n Prompt must describe visual flow, motion, sound/music/no-music, dialogue/no-dialogue, ending frame, and how the selected duration should feel naturally filled.\n\n Options:\n --video <file> Generated .mp4 filename (required)\n --duration <1..15> Default: 5. Prompt motion should naturally fill this length\n --resolution <480p|720p> Default: 720p\n --aspect-ratio <ratio|auto> Default: auto\n --model <name> grok-imagine-video, grok-imagine-video-1.5-preview\n -o, --out <file> Download continued video to file\n --output <file> Alias for --out\n --json Print JSON result\n --timeout <sec> Default: 600\n --server <url> Override server URL`);
445
+ out(` ima2 video continue <prompt> --video <generated-file>\n\n Generate a new clip from a generated video's last frame and carry branch-local revisedPrompt lineage.\n\n Prompt must describe visual flow, motion, sound/music/no-music, dialogue/no-dialogue, ending frame, and how the selected duration should feel naturally filled.\n\n Options:\n --video <file> Generated .mp4 filename (required)\n --duration <1..15> Default: 5. Prompt motion should naturally fill this length\n --resolution <480p|720p|1080p> Default: 720p. 1080p requires --model grok-imagine-video-1.5\n --aspect-ratio <ratio|auto> Default: auto\n --model <name> grok-imagine-video, grok-imagine-video-1.5 (preview alias accepted)\n -o, --out <file> Download continued video to file\n --output <file> Alias for --out\n --json Print JSON result\n --timeout <sec> Default: 600\n --server <url> Override server URL`);
433
446
  return;
434
447
  }
435
448
  const prompt = args.positional.join(" ");
@@ -442,13 +455,15 @@ async function videoContinueCmd(argv) {
442
455
  die(2, "--duration must be between 1 and 15");
443
456
  const resolution = String(args.resolution);
444
457
  if (!VALID_RESOLUTIONS.has(resolution))
445
- die(2, "--resolution must be one of: 480p, 720p");
458
+ die(2, "--resolution must be one of: 480p, 720p, 1080p");
446
459
  const aspectRatio = String(args["aspect-ratio"]);
447
460
  if (!VALID_ASPECT_RATIOS.has(aspectRatio))
448
461
  die(2, "--aspect-ratio must be one of: 1:1, 16:9, 9:16, 4:3, 3:4, 3:2, 2:3, auto");
449
462
  if (args.model && !VALID_MODELS.has(String(args.model))) {
450
- die(2, "--model must be one of: grok-imagine-video, grok-imagine-video-1.5-preview");
463
+ die(2, "--model must be one of: grok-imagine-video, grok-imagine-video-1.5");
451
464
  }
465
+ const model = args.model ? canonicalVideoModel(String(args.model)) : GROK_VIDEO_MODEL_BASE;
466
+ validateCliVideoResolution(model, resolution, "image-to-video");
452
467
  parseTimeoutSeconds(args.timeout);
453
468
  let server;
454
469
  try {
@@ -468,7 +483,7 @@ async function videoContinueCmd(argv) {
468
483
  continueFromVideo: args.video,
469
484
  };
470
485
  if (args.model)
471
- body.model = args.model;
486
+ body.model = model;
472
487
  if (args["planner-model"])
473
488
  body.plannerModel = args["planner-model"];
474
489
  if (args.storyboard)
package/docs/API.md CHANGED
@@ -362,7 +362,7 @@ Generate a video via the Grok video provider. Returns Server-Sent Events on the
362
362
  }
363
363
  ```
364
364
 
365
- **Models**: `grok-imagine-video` (default), `grok-imagine-video-1.5-preview`.
365
+ **Models**: `grok-imagine-video` (default), `grok-imagine-video-1.5`. The legacy `grok-imagine-video-1.5-preview` string is accepted as a compatibility alias and normalized before the upstream request.
366
366
 
367
367
  **Mode** is auto-detected from reference inputs:
368
368
 
@@ -372,6 +372,8 @@ Generate a video via the Grok video provider. Returns Server-Sent Events on the
372
372
  | 1 image (`sourceImage` or `sourceFilename`) | image-to-video | 1–15s |
373
373
  | 2–7 images (`referenceImages` / `referenceFilenames`) | reference-to-video | 1–10s |
374
374
 
375
+ 1080p is accepted for `grok-imagine-video-1.5` prompt-only text-to-video and image-to-video with one image/frame source, including `continueFromVideo` after the server extracts the parent video's last frame. Prompt-only 1.5 text-to-video uses the internal white-canvas image-to-video shim before the upstream request. 1.5 does not add Ref2V, V2V edit, or extension support.
376
+
375
377
  **Parameters**:
376
378
 
377
379
  | Field | Type | Default | Notes |
@@ -380,7 +382,7 @@ Generate a video via the Grok video provider. Returns Server-Sent Events on the
380
382
  | `provider` | string | `"grok"` | `"grok"` or `"grok-api"` |
381
383
  | `model` | string | `grok-imagine-video` | Video model |
382
384
  | `duration` | integer | `5` | 1–15 seconds (clamped to 10 for reference-to-video) |
383
- | `resolution` | string | `"480p"` | `480p` or `720p` |
385
+ | `resolution` | string | `"480p"` | `480p`, `720p`, or `1080p` (`1080p` uses 1.5 T2V canvas shim or I2V) |
384
386
  | `aspectRatio` | string | `"auto"` | 1:1, 16:9, 9:16, 4:3, 3:4, 3:2, 2:3, auto |
385
387
  | `sourceImage` | string | — | Base64 image for image-to-video |
386
388
  | `sourceFilename` | string | — | Existing generated file for image-to-video |
@@ -459,7 +461,7 @@ Grok prompt surfaces used by video APIs:
459
461
  | `VIDEO_PROVIDER_UNSUPPORTED` | Provider is not `"grok"` |
460
462
  | `PROMPT_REQUIRED` | Empty or missing prompt |
461
463
  | `INVALID_GROK_VIDEO_MODEL` | Model not in valid set |
462
- | `INVALID_VIDEO_RESOLUTION` | Resolution not 480p or 720p |
464
+ | `INVALID_VIDEO_RESOLUTION` | Resolution is not 480p/720p/1080p, or 1080p was requested outside `grok-imagine-video-1.5` prompt-only T2V / I2V |
463
465
  | `INVALID_VIDEO_ASPECT_RATIO` | Aspect ratio not in valid set |
464
466
  | `INVALID_VIDEO_DURATION` | Duration not 1–15 integer |
465
467
  | `GROK_VIDEO_REF_TOO_MANY` | More than 7 reference images |
@@ -493,7 +495,7 @@ Extend a video from its last frame. This is a blocking JSON endpoint that starts
493
495
  }
494
496
  ```
495
497
 
496
- `duration` must be an integer from 2 to 10 seconds. Edit and extension support `grok-imagine-video` only; `grok-imagine-video-1.5-preview` is not accepted for these endpoints.
498
+ `duration` must be an integer from 2 to 10 seconds. Edit and extension support `grok-imagine-video` only; `grok-imagine-video-1.5` and its preview alias are not accepted for these endpoints.
497
499
 
498
500
  ### `GET /api/video/frame`
499
501
 
@@ -516,6 +518,12 @@ Analyze first and last frames from a generated `.mp4` using Grok 4.3 image under
516
518
 
517
519
  Remote URLs and `data:` inputs are intentionally rejected to avoid server-side URL fetching through `ffmpeg`.
518
520
 
521
+ ## Generation Request Log
522
+
523
+ | Method | Path | Notes |
524
+ |---|---|---|
525
+ | `GET` | `/api/generation-requests` | Returns `{ items: GenerationRequestLogEntry[] }` — the last 200 generation attempts (prompt, requested/succeeded flags, error). Surfaced in the web UI dev panel (`GenerationRequestLogPanel`); no CLI wrapper (#95). |
526
+
519
527
  ## History
520
528
 
521
529
  | Method | Path | Notes |
@@ -561,6 +569,62 @@ X-Ima2-Tab-Id
561
569
 
562
570
  Style-sheet extraction can require an API key/openai client. Image generation also supports `provider: "api"` through the shared Responses API image adapter when an API key is configured.
563
571
 
572
+ ## Prompt Library
573
+
574
+ Backed by `routes/prompts.ts` and SQLite prompt tables in `lib/db.ts`.
575
+
576
+ | Method | Path | Notes |
577
+ |---|---|---|
578
+ | `GET` | `/api/prompts` | List prompts (`folderId`, `q`, `favoritesOnly`, pagination) |
579
+ | `POST` | `/api/prompts` | Create prompt |
580
+ | `GET` | `/api/prompts/:id` | Fetch one prompt |
581
+ | `PATCH` | `/api/prompts/:id` | Update prompt fields |
582
+ | `DELETE` | `/api/prompts/:id` | Delete prompt |
583
+ | `POST` | `/api/prompts/:id/favorite` | Toggle favorite |
584
+ | `POST` | `/api/prompts/import` | Legacy bulk import (JSON body) |
585
+ | `GET` | `/api/prompts/export` | Export prompt library JSON |
586
+ | `GET` | `/api/prompts/folders` | List folders |
587
+ | `POST` | `/api/prompts/folders` | Create folder |
588
+ | `PATCH` | `/api/prompts/folders/:id` | Rename folder |
589
+ | `DELETE` | `/api/prompts/folders/:id` | Delete folder |
590
+
591
+ ## Prompt Import
592
+
593
+ Preview/commit import flow for local files, GitHub folders, curated sources, and discovery review. Implemented in `routes/promptImport.ts`.
594
+
595
+ | Method | Path | Notes |
596
+ |---|---|---|
597
+ | `GET` | `/api/prompts/import/curated-sources` | List curated source registry entries |
598
+ | `GET` | `/api/prompts/import/discovery` | List discovery review queue |
599
+ | `POST` | `/api/prompts/import/discovery-search` | Search GitHub for prompt-pack candidates |
600
+ | `POST` | `/api/prompts/import/discovery-review` | Approve/reject discovery candidate |
601
+ | `POST` | `/api/prompts/import/curated-search` | Search indexed curated sources |
602
+ | `POST` | `/api/prompts/import/curated-refresh` | Refresh curated index cache |
603
+ | `POST` | `/api/prompts/import/folder-files` | List files in a GitHub folder |
604
+ | `POST` | `/api/prompts/import/folder-preview` | Preview selected GitHub folder files |
605
+ | `POST` | `/api/prompts/import/preview` | Preview local/GitHub import candidates |
606
+ | `POST` | `/api/prompts/import/commit` | Commit selected candidates into the prompt library |
607
+
608
+ ## Card News (dev-gated)
609
+
610
+ Registered only when `config.features.cardNews` is true (`routes/cardNews.ts`). Web UI requires `VITE_IMA2_CARD_NEWS=1` or `VITE_IMA2_DEV=1`; CLI uses `ima2 cardnews …`.
611
+
612
+ | Method | Path | Notes |
613
+ |---|---|---|
614
+ | `GET` | `/api/cardnews/image-templates` | List image templates |
615
+ | `GET` | `/api/cardnews/image-templates/:templateId/preview` | Template preview image |
616
+ | `GET` | `/api/cardnews/role-templates` | Built-in role templates |
617
+ | `GET` | `/api/cardnews/sets` | List card-news sets |
618
+ | `GET` | `/api/cardnews/sets/:setId` | Fetch one set |
619
+ | `GET` | `/api/cardnews/sets/:setId/manifest` | Set manifest JSON |
620
+ | `POST` | `/api/cardnews/draft` | Create planner draft |
621
+ | `POST` | `/api/cardnews/generate` | Start card generation job |
622
+ | `POST` | `/api/cardnews/jobs` | Create job record |
623
+ | `GET` | `/api/cardnews/jobs/:jobId` | Poll job status |
624
+ | `POST` | `/api/cardnews/jobs/:jobId/retry` | Retry failed job |
625
+ | `POST` | `/api/cardnews/cards/:cardId/regenerate` | Regenerate one card |
626
+ | `POST` | `/api/cardnews/export` | Export completed set assets |
627
+
564
628
  ## Common Error Codes
565
629
 
566
630
  | Code | Meaning |
@@ -629,6 +693,28 @@ Keys saved via PUT are stored in `config.json` and hot-updated in the runtime co
629
693
 
630
694
  Thumbnails are also generated automatically on server startup for any media files that lack them.
631
695
 
696
+ ## Agent Mode
697
+
698
+ Agent Mode is a conversational image workspace (web UI only — no CLI). All routes are under `/api/agent/*` and are backed by `routes/agent.ts` + `lib/agent*.ts`.
699
+
700
+ | Method | Path | Notes |
701
+ |---|---|---|
702
+ | `GET` | `/api/agent/tools` | Slash-command and tool metadata |
703
+ | `GET` | `/api/agent/sessions` | List sessions (`?limit=`) |
704
+ | `POST` | `/api/agent/sessions` | Create session (`title`, `currentImage`, `webSearchEnabled`) → `201` |
705
+ | `GET` | `/api/agent/sessions/:sessionId` | Fetch one session |
706
+ | `PATCH` | `/api/agent/sessions/:sessionId` | Update title, `webSearchEnabled`, `generationSettings`, `currentImage`, locks |
707
+ | `DELETE` | `/api/agent/sessions/:sessionId` | Delete session |
708
+ | `POST` | `/api/agent/sessions/:sessionId/compact` | Session compaction |
709
+ | `GET` | `/api/agent/sessions/:sessionId/manifest` | XML manifest export |
710
+ | `POST` | `/api/agent/sessions/:sessionId/turns` | Synchronous turn (`prompt`, provider, quality, size, model, …) |
711
+ | `GET` | `/api/agent/sessions/:sessionId/errors` | Recent errors (`?limit=`, default 10) |
712
+ | `GET` | `/api/agent/sessions/:sessionId/queue` | Per-session queue items |
713
+ | `POST` | `/api/agent/sessions/:sessionId/queue` | Enqueue async turn / slash command → `202` |
714
+ | `GET` | `/api/agent/queue` | Global queue listing |
715
+ | `POST` | `/api/agent/queue/:itemId/cancel` | Cancel queued item |
716
+ | `POST` | `/api/agent/queue/:itemId/retry` | Retry failed item |
717
+
632
718
  ## Endpoint → CLI Mapping
633
719
 
634
720
  Most server routes under `/api/*` have a CLI wrapper. The exception is **Agent Mode** (`/api/agent/*`), which is server + web-UI-only and has no `ima2` subcommand. The prompt builder HTTP route (`POST /api/prompt-builder/chat`) is wrapped by `ima2 prompt build`. Use this table to find the command that calls a given endpoint. (See README.md "Client" section for full flag lists.)
@@ -665,7 +751,7 @@ Most server routes under `/api/*` have a CLI wrapper. The exception is **Agent M
665
751
  | `GET /api/events` (SSE multiplex) | Web UI only (persistent `EventSource`; no CLI wrapper) |
666
752
  | `GET /api/storage/status` / `POST /api/storage/open-generated-dir` | `ima2 storage status` / `ima2 storage open` |
667
753
  | `GET /api/billing` / `GET /api/providers` / `GET /api/oauth/status` / `GET /api/grok/status` | `ima2 billing` / `ima2 providers` / `ima2 oauth status` / `ima2 grok status` |
668
- | `GET /api/quota` | `ima2 billing` (includes Grok `usedUsd`/`limitUsd`) |
754
+ | `GET /api/quota` | Web UI only (Grok quota bar in Settings) |
669
755
  | `POST /api/auth/switch` / `GET /api/auth/switch/:sessionId` | Web UI only (Settings > QuotaCard > Switch Account) |
670
756
  | `GET /api/health` | `ima2 ping` |
671
757
  | `GET /api/capabilities` | `ima2 capabilities` |
package/docs/CLI.md CHANGED
@@ -126,9 +126,9 @@ Video generate flags:
126
126
  | Flag | Meaning |
127
127
  |---|---|
128
128
  | `--duration <1..15>` | Duration in seconds (default: 5) |
129
- | `--resolution <480p\|720p>` | Video resolution (default: 480p) |
129
+ | `--resolution <480p\|720p\|1080p>` | Video resolution (default: 480p). 1080p requires `--model grok-imagine-video-1.5`; prompt-only 1.5 uses the internal white-canvas I2V shim |
130
130
  | `--aspect-ratio <ratio\|auto>` | 1:1, 16:9, 9:16, 4:3, 3:4, 3:2, 2:3, auto (default: auto) |
131
- | `--model <name>` | `grok-imagine-video` or `grok-imagine-video-1.5-preview` |
131
+ | `--model <name>` | `grok-imagine-video` or `grok-imagine-video-1.5`; `grok-imagine-video-1.5-preview` is accepted as a compatibility alias |
132
132
  | `--planner-model <name>` | Grok planner override (default: `grok-4.3`; also in settings UI and `IMA2_GROK_PLANNER_MODEL`) |
133
133
  | `--storyboard` | Enable storyboard mode — maintains character/scene continuity across sequential clips |
134
134
  | `--ref <file>` | Attach source/reference image (repeatable, max 7) |
@@ -161,7 +161,7 @@ Video continue flags:
161
161
  |---|---|
162
162
  | `--video <generated-file>` | Parent generated `.mp4`; server extracts its last frame |
163
163
  | `--duration <1..15>` | New clip duration (default: 5) |
164
- | `--resolution <480p\|720p>` | New clip resolution (default: 720p) |
164
+ | `--resolution <480p\|720p\|1080p>` | New clip resolution (default: 720p). 1080p requires `--model grok-imagine-video-1.5` |
165
165
  | `--aspect-ratio <ratio\|auto>` | New clip aspect ratio |
166
166
  | `--model <name>` | Optional video generation model |
167
167
 
@@ -175,13 +175,14 @@ Video mode is auto-detected from `--ref` count:
175
175
  | 1 | image-to-video |
176
176
  | 2–7 | reference-to-video (max 10s duration) |
177
177
 
178
- `grok-imagine-video-1.5-preview` supports image-to-video, but not `reference_images` reference-to-video. Prompt-only 1.5 text-to-video uses an internal white-canvas image-to-video anchor. For 2+ refs, use `grok-imagine-video`; if ima2 auto-retries from 1.5-preview to the base model, read `video.effectiveModel` and `video.modelFallback` from CLI `--json`, or `effectiveModel` and `modelFallback` from SSE. Video edit and extension are also base-model only.
178
+ `grok-imagine-video-1.5` supports 1080p for prompt-only text-to-video and single image/frame image-to-video. Prompt-only 1.5 text-to-video is submitted through the internal white-canvas image-to-video shim because upstream 1.5 rejects raw T2V. The old `grok-imagine-video-1.5-preview` name is accepted as an alias and normalized before the upstream request. 1.5 does not support `reference_images` reference-to-video, V2V edit, or video extension. For 2+ refs, use `grok-imagine-video`; if ima2 auto-retries a 1.5 Ref2V request to the base model, read `video.effectiveModel` and `video.modelFallback` from CLI `--json`, or `effectiveModel` and `modelFallback` from SSE.
179
179
 
180
180
  SSE events: `planning` → `submitted` → `progress` (0–100%) → `done` or `error`.
181
181
 
182
182
  ```bash
183
183
  ima2 video "a cat playing piano"
184
184
  ima2 video "animate this" --ref photo.png --duration 10
185
+ ima2 video "animate this in high detail" --ref photo.png --model grok-imagine-video-1.5 --resolution 1080p
185
186
  ima2 video "cinematic" --resolution 720p --aspect-ratio 16:9 -o out.mp4
186
187
  ima2 video "style transfer" --ref a.png --ref b.png --ref c.png --model grok-imagine-video
187
188
  ima2 video edit "make the lighting warm sunset" --video 1780226256355_50252101.mp4 -o edited.mp4
@@ -280,12 +281,12 @@ Windows DNS/fragmentation bypass tool such as SecretDNS is in use.
280
281
  | `ima2 prompt edit <id> [--name] [--text] [--folder] [--tags]` | Edit |
281
282
  | `ima2 prompt rm <id>` | Delete |
282
283
  | `ima2 prompt favorite <id>` | Toggle favorite |
283
- | `ima2 prompt export <id> [-o <file>]` | Export one prompt to JSON |
284
+ | `ima2 prompt export [-o <file>]` | Export all prompts to JSON |
284
285
  | `ima2 prompt folder ls / create <name> / rename <id> <name> / rm <id> [--strategy moveToRoot\|deleteItems]` | Folder CRUD |
285
286
  | `ima2 prompt import sources` | List configured import sources |
286
287
  | `ima2 prompt import refresh --source <id>` | Re-index a source |
287
288
  | `ima2 prompt import curated --source <id> --q <query>` | Curated import (commits prompts) |
288
- | `ima2 prompt import discovery --q <query> --seeds <a,b,c>` | Discovery import (curator-only on some servers) |
289
+ | `ima2 prompt import discovery --q <query> --seed <repo>...` | Discovery import (curator-only on some servers) |
289
290
  | `ima2 prompt import folder <localpath>` | Import a local folder of prompts |
290
291
  | `ima2 prompt import json <file\|@file\|-> [--folder <id>]` | Import a JSON export body through `/api/prompts/import` |
291
292
  | `ima2 prompt import preview <file\|@file\|-> [--filename <name>]` | Preview local markdown/text candidates without committing |
@@ -318,7 +319,7 @@ Card News requires the server to be started with `IMA2_CARD_NEWS=1` (or `feature
318
319
  | `ima2 inflight rm <requestId>` | Force-remove a stuck job |
319
320
  | `ima2 storage status` | Storage inspection (richer than `doctor`) |
320
321
  | `ima2 storage open` | Open the generated dir in the OS file manager (POST) |
321
- | `ima2 billing` | API usage / quota; Grok result includes `billing.usedUsd` / `billing.limitUsd` drawn from the xAI billing API |
322
+ | `ima2 billing` | API usage probe via `/api/billing` (OpenAI/API-key credits when configured). Grok quota (`usedUsd`/`limitUsd`) is web-UI only via `GET /api/quota`. |
322
323
  | `ima2 providers` | Configured providers |
323
324
  | `ima2 oauth status` | OAuth proxy state |
324
325
  | `ima2 grok status` | Bundled progrok / xAI image-model probe state |
package/docs/README.ja.md CHANGED
@@ -10,7 +10,7 @@
10
10
 
11
11
  `ima2-gen` は、無料の ChatGPT と SuperGrok だけで画像と動画を作れるローカル AI スタジオです。
12
12
 
13
- グローバルインストールし、ChatGPT または Grok OAuth でログインすれば、すぐに画像・動画生成を始められます。API キー不要で、ノード分岐、multimode batch、Grok Video、Canvas Mode まで全機能が使えます。
13
+ グローバルインストールし、ChatGPT または Grok OAuth でログインすれば、すぐに画像・動画生成を始められます。デフォルトの OAuth パスは API キー不要です。オプションで API キー系プロバイダー(`api`, `grok-api`, `gemini-api`, `agy`)も利用できます。
14
14
 
15
15
  ![プロンプト入力、生成画像、モデル表示、結果メタデータが見える ima2-gen classic 画面](../assets/screenshots/classic-generate-light.png)
16
16
 
@@ -24,30 +24,93 @@ ima2 serve
24
24
 
25
25
  その後、`http://localhost:3333` を開きます。
26
26
 
27
+ CLI で動画生成:
28
+
29
+ ```bash
30
+ ima2 video "猫がピアノを弾く" --duration 5 --resolution 720p
31
+ ima2 video "このシーンをアニメ化" --ref photo.png --duration 10
32
+ ```
33
+
27
34
  `3333` がすでに使われている場合、次に空いているポートで起動し、実際の URL は `~/.ima2/server.json` に書き込まれます。ポートを決め打ちせず、terminal に表示された URL または `ima2 open` を使ってください。
28
35
 
29
36
  > **npx を使いたい場合は?** [NPX_QUICKSTART.md](NPX_QUICKSTART.md) を参照してください。
30
37
 
38
+ ### ワンクリックインストール(npm 不要)
39
+
40
+ Node.js や npm がなくても、プラットフォーム用インストールスクリプトが環境を検出し、必要なら Node LTS を入れてから ima2-gen をインストールします。
41
+
42
+ **macOS:**
43
+ ```bash
44
+ curl -fsSL https://lidge-jun.github.io/ima2-gen/install-mac.sh | bash
45
+ ```
46
+
47
+ **Windows (PowerShell):**
48
+ ```powershell
49
+ irm https://lidge-jun.github.io/ima2-gen/install-windows.ps1 | iex
50
+ ```
51
+
52
+ **Linux / WSL:**
53
+ ```bash
54
+ curl -fsSL https://lidge-jun.github.io/ima2-gen/install-linux.sh | bash
55
+ ```
56
+
57
+ 各スクリプトは nvm/fnm/brew/winget を確認し、最適な方法で Node LTS を入れ、古いプロセスのクリーンアップも自動で行います。
58
+
59
+ ### セットアップ
60
+
61
+ `ima2 setup` では認証方式を4つ選べます:
62
+
63
+ 1. **GPT OAuth** — ChatGPT アカウントでログイン(無料、画像のみ)
64
+ 2. **Grok OAuth** — xAI/Grok アカウントでログイン(画像 + 動画)
65
+ 3. **Both** — GPT + Grok 両方(全機能)
66
+ 4. **Web setup** — Web UI で設定
67
+
68
+ 動画生成には Grok OAuth(2 または 3)が必要です。GPT OAuth だけ設定済みで動画を追加する場合は `ima2 grok login` を別途実行してください。
69
+
70
+ ### アップデート
71
+
72
+ 実行中の server を Ctrl+C で止めてから:
73
+
74
+ ```bash
75
+ npm install -g ima2-gen@latest
76
+ ```
77
+
78
+ Ctrl+C は DB クローズ、子プロセス停止、ファイルロック解放まで行うクリーンシャットダウンです。古いバージョン(< 1.1.22)や Windows で `EBUSY` が出る場合は、インストールスクリプトが stale プロセスを自動クリーンアップします。
79
+
31
80
  ## できること
32
81
 
33
82
  - **Classic mode**: すばやく生成し、編集し、現在の画像を次の参照として使えます。
34
83
  - **Node mode**: 良い画像を起点に、複数の方向へ分岐して試せます。
35
84
  - **Multimode batches**: 1つのプロンプトから複数候補を同時に走らせ、slot ごとの進行を見ながら最も良い結果から作業を継続できます。
36
85
  - **Canvas Mode**: zoom/pan、annotation、eraser、background cleanup、transparent checkerboard preview、alpha/matte export をサポートします。
37
- - **Local gallery**: 生成物をローカルに保存し、セッションごとの履歴として確認できます。
38
- - **Reference images**: 参照画像を drag/drop、paste、file picker で追加できます。大きな画像は送信前に圧縮されます。
86
+ - **Video generation**: テキスト、画像、複数参照から短い動画を生成。SSE で planning→submitted→progress→done。First/Mid/Last フレームコピー対応。
87
+ - **Storyboard mode**: コンポーザーの storyboard トグルで連続フレームのキャラクター・シーン連続性を維持(画像・動画両対応)。
88
+ - **Local gallery**: 生成物をローカル保存。デフォルトは現在セッション、All Images トグルで全履歴。生成時間と reasoning effort をメタデータに記録。
89
+ - **Reference images**: ドラッグ/ペースト/ファイル選択。画像最大5、動画最大7。大きい画像は自動圧縮。
39
90
  - **Prompt library imports**: local prompt pack、GitHub folder、curated GPT-image hint を built-in prompt library に取り込めます。
40
91
  - **Mobile shell**: 小さい画面では app bar、compose sheet、compact settings toggle で操作できます。
41
92
  - **Observable jobs**: 進行中の生成と最近の生成を request ID で追跡できます。
42
93
 
94
+ ### SSE マルチプレキシング
95
+
96
+ Web UI は単一の `GET /api/events` Server-Sent Events 接続で全生成の進行を受信します。Multimode、node、video リクエストは非同期 POST(`202 { requestId }`)で送信され、共有イベントバス経由で進行イベントがマルチプレクスされます。これにより、同時生成時のブラウザ 6 接続制限によるギャラリー hang が解消されます。`async: true` を送らない CLI クライアントは、後方互換のため従来どおりリクエストごとの SSE ストリームを受け取れます。
97
+
43
98
  ## 画像生成は OAuth と API key をサポートします
44
99
 
45
100
  既定の画像生成は、ローカルの Codex/ChatGPT OAuth 経路で実行されます。
46
101
 
47
102
  API key が env/config に存在する場合、生成エンドポイントで `provider: "api"` を指定すると Responses API の `image_generation` tool を使用できます。
48
103
 
104
+ - `provider: "grok-api"` — `XAI_API_KEY` で xAI Images API を直接呼び出し
105
+ - `provider: "agy"` — ローカル Antigravity CLI (`IMA2_AGY_BIN`)
106
+ - `provider: "gemini-api"` — `GEMINI_API_KEY` または Vertex (`VERTEX_SERVICE_ACCOUNT_JSON`、Vertex 優先)
107
+
49
108
  Settings に **API key provider available** と表示される場合、API key が検出され、生成・編集・multimode・node request に使用できるという意味です。
50
109
 
110
+ Grok 動画は `grok-imagine-video`(既定)または正式名 `grok-imagine-video-1.5` を使用します。従来の `grok-imagine-video-1.5-preview` は互換 alias として受け付けます。参照数に応じて T2V(0)、I2V(1)、Ref2V(2-7、最大10秒)が自動選択され、1080p は `grok-imagine-video-1.5` の単一画像/フレーム I2V でのみ有効です。1.5 は Ref2V、V2V edit、extension を追加サポートしないため、それらは既定モデルのみです。duration(1-15s)、resolution(480p/720p/対応時 1080p)、aspect ratio を設定できます。
111
+
112
+ 設定画面の QuotaCard に Grok billing `$used/$limit` バーと **Switch Account** ボタン(`POST /api/auth/switch`)が表示されます。
113
+
51
114
  ![OAuth active と API key provider available の状態を示す settings 画面](../assets/screenshots/settings-oauth-generation.png)
52
115
 
53
116
  ## モデルの選び方
@@ -120,6 +183,7 @@ Settings ワークスペースでは、アカウント、モデル、テーマ
120
183
  | `ima2 setup` | 認証設定を再構成 |
121
184
  | `ima2 status` | config と OAuth 状態を表示 |
122
185
  | `ima2 doctor` | Node、package、config、auth を診断 |
186
+ | `ima2 doctor image-probe [--json]` | 画像なし診断用 sanitized probe |
123
187
  | `ima2 open` | Web UI を開く |
124
188
  | `ima2 reset` | 保存済み config を削除 |
125
189
 
@@ -132,6 +196,7 @@ Settings ワークスペースでは、アカウント、モデル、テーマ
132
196
  | `ima2 gen <prompt>` | CLI から画像生成 |
133
197
  | `ima2 edit <file> --prompt <text>` | 既存画像を編集 |
134
198
  | `ima2 multimode <prompt>` | マルチイメージ SSE 生成 |
199
+ | `ima2 video <prompt>` | Grok 動画生成(SSE 進捗) |
135
200
  | `ima2 ls [--session <id>] [--favorites]` | ローカル履歴を表示 |
136
201
  | `ima2 show <name> [--metadata]` | 生成ファイルを開く |
137
202
  | `ima2 prompt ls -q <検索>` | プロンプトライブラリ検索 |
@@ -162,9 +227,13 @@ environment variables > ~/.ima2/config.json > built-in defaults
162
227
  | `IMA2_GENERATED_DIR` | `~/.ima2/generated` | Generated image directory |
163
228
  | `IMA2_IMAGE_MODEL_DEFAULT` | `gpt-5.4-mini` | Server fallback image model |
164
229
  | `IMA2_NO_OAUTH_PROXY` | — | `1` で OAuth proxy の自動起動を無効化 |
165
- | `IMA2_LOG_LEVEL` | `warn` | 通常の `serve` は `warn`、dev mode は `debug`。`debug`, `info`, `warn`, `error`, `silent` をサポート |
166
- | `IMA2_INFLIGHT_TERMINAL_TTL_MS` | `30000` | デバッグ用の recent job retention |
167
- | `OPENAI_API_KEY` | — | 補助機能用。画像生成用ではありません |
230
+ | `IMA2_LOG_LEVEL` | `info` | 通常の `serve` は `info`、dev mode は `debug`。`debug`, `info`, `warn`, `error`, `silent` をサポート |
231
+ | `IMA2_INFLIGHT_TERMINAL_TTL_MS` | `300000` | デバッグ用の recent job retention |
232
+ | `OPENAI_API_KEY` | — | `provider: "api"` の Responses 画像パスと補助機能用 |
233
+ | `XAI_API_KEY` | — | `provider: "grok-api"` 直接 xAI Images API |
234
+ | `GEMINI_API_KEY` | — | `provider: "gemini-api"` Generative Language API |
235
+ | `VERTEX_SERVICE_ACCOUNT_JSON` | — | Vertex AI サービスアカウント JSON(API キーより優先) |
236
+ | `IMA2_AGY_BIN` | PATH の `agy` | `provider: "agy"` バイナリパス |
168
237
 
169
238
  ### Logging modes
170
239
 
@@ -186,9 +255,15 @@ Endpoint 一覧は [API Reference](API.md) に分離しました。
186
255
  **OAuth login がうまくいかない**
187
256
  `ima2 setup` を再実行(オプション 1)し、`ima2 status` を確認してから `ima2 serve` を再起動してください。
188
257
 
258
+ **proxy/VPN 環境で `fetch failed` が繰り返される**
259
+ ローカル OAuth proxy に到達できるか確認してください。プロキシ必須のネットワークでは、プロキシクライアントの TUN/TURN 系モードを有効にしてから `openai-oauth --port 10531` を再試行してください。それでも失敗する場合は、`ima2 serve` や `openai-oauth` を実行する同じ terminal で `HTTP_PROXY` と `HTTPS_PROXY` を設定してください。Windows では SecretDNS など DNS/断片化バイパス系ツールが OAuth やストリーミング画像応答を壊すことがあります。
260
+
189
261
  **画像生成が `API_KEY_REQUIRED` で失敗する**
190
262
  `provider: "api"` request に使う API key が設定されていません。API key を設定するか OAuth provider に切り替えてください。
191
263
 
264
+ **画像生成が `EMPTY_RESPONSE` になる、または画像データが返らない**
265
+ `ima2 doctor image-probe --json > ima2-image-probe.json` を実行し、issue 作成時に安全な JSON を添付してください。GPT OAuth の場合は、`ima2 serve` 実行中に `ima2 gen "猫" --no-web-search --json` と `ima2 gen "猫" --json` も取得してください。ChatGPT cookie、OAuth トークンファイル、API key、生の upstream 応答、プロンプト履歴、生成 base64 は共有しないでください。詳細は [FAQ サポートバンドル](FAQ.md#what-should-i-share-when-oauth-image-generation-returns-no-image) を参照してください。
266
+
192
267
  **大きな参照画像が失敗する**
193
268
  JPEG/PNG は送信前に自動圧縮されます。それでも失敗する場合は、解像度を下げた JPEG/PNG に変換してください。HEIC/HEIF は browser path ではサポートしていません。
194
269
 
@@ -198,8 +273,11 @@ JPEG/PNG は送信前に自動圧縮されます。それでも失敗する場
198
273
  **`gpt-5.5` だけ失敗する**
199
274
  まず Codex CLI を最新版に更新してから再試行してください。それでも失敗する場合は、現在のアカウントやバックエンド経路で `gpt-5.5` の image capability または使用量枠がまだ異なる可能性があります。安定した代替として `gpt-5.4` を使ってください。
200
275
 
201
- **Port が突然 `3457` になる**
202
- 別のローカルツールから `PORT=3457` が引き継がれている可能性があります。`unset PORT` するか、`IMA2_PORT=3333 ima2 serve` で起動してください。
276
+ **別のポートでアプリが開く**
277
+ 要求した server ポートが使用中の場合、ima2-gen は次の空きポートに fallback し、`~/.ima2/server.json` に記録します。ポートが想定外の `3457` になる場合、shell が別ツールの `PORT=3457` を引き継いでいる可能性があります。`unset PORT` するか、`IMA2_PORT=3333 ima2 serve` で起動してください。
278
+
279
+ **Windows でポート `10531` が既に使われている**
280
+ Windows のセキュリティツール(`AnySign4PC.exe` など)が既定 OAuth proxy ポートを占有することがあります。現在のビルドは実際の fallback OAuth ポートを追跡します。手動上書きが必要な場合は `IMA2_OAUTH_PROXY_PORT=11531 ima2 serve` で起動し、`ima2 doctor` で確認してください。
203
281
 
204
282
  より詳しい確認手順は [FAQ](FAQ.md) を参照してください。
205
283