Skip to content

Expand migrated image API: model selection, edits and 2K export - #42

Merged
crisng95 merged 4 commits into
crisng95:mainfrom
Bl0ck154:feature/migrated-image-api
Sep 17, 2026
Merged

crisng95 merged 4 commits into
crisng95:mainfrom
Bl0ck154:feature/migrated-image-api

Conversation

@Bl0ck154

@Bl0ck154 Bl0ck154 commented Sep 8, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Expands the migrated flow.google.com image path with the capabilities currently exposed by Flow's UI, fixes Nano Banana Pro transport/count semantics, adds bounded wave-based recovery for transient image failures, and restores true image edit + high-resolution export.

What changes

  • expose explicit image_model selection on POST /api/flow/generate-image
  • add HARBOR_SEAL (Nano Banana 2 Lite) alongside Nano Banana Pro / Nano Banana 2
  • pass syntactically valid future Flow image wire ids through unchanged
  • expose count (1-4) and optional seed
  • implement count=N like Flow itself: N independent single-image ogiZ0b RPCs, each with its own single-use reCAPTCHA
  • mirror Flow's captured x4 launch cadence (~0.0 / 0.5 / 1.5 / 2.5 seconds) instead of bursting every variant simultaneously
  • serialize Enterprise reCAPTCHA minting in the page bridge
  • include WIZ source-path and page locale metadata; GEM_PIX_2 requires this even where Lite is tolerant
  • wait for the entire first image wave to settle before retrying transient image RPC [8]
  • retry only [8], once, after a 34-second cooldown with fresh request UUIDs and the same seed
  • preserve successful variants after a final partial failure and return complete=false, generated_count, and failed_variants
  • accept all five current image ratios: 1:1, 9:16, 16:9, 3:4, 4:3
  • use the current IMAGE_ASPECT_RATIO_PORTRAIT_THREE_FOUR spelling while retaining the old alias
  • fix /api/flow/edit-image: source media uses Flow's BASE_IMAGE wire type (2), extra refs remain REFERENCE type (1)
  • port image high-resolution download through SPrCad / FlowService.UpsampleImage
  • add POST /api/flow/export-image (2k default, 4k plan-gated)

Live verification

Verified end-to-end against the current Flow frontend/account:

  • Nano Banana 2 Lite generated successfully, including count=4
  • Nano Banana 2 generated successfully
  • Nano Banana Pro direct generation works once source-path matches the UI
  • live CDP capture proved Flow x4 uses four independent ogiZ0b requests, not one multi-item RPC
  • Nano Banana Pro x4 using the captured UI cadence returned 4/4 images in 57.4s wall-clock
  • final combined wave implementation Nano Banana Pro x2 returned 2/2, complete=true, in 63.37s
  • a short 6-second retry was still rejected under load, motivating the longer bounded cooldown
  • Nano Banana Pro generated a real BASE_IMAGE edit successfully
  • SPrCad 2K export produced a valid JPEG; 1376x768 source -> 2752x1536 (~3.1 MB)

The current Flow UI exposes exactly five image aspect ratios: 1:1, 9:16, 16:9, 3:4, 4:3.

The [8] retry is explicitly a FlowKit resilience policy. Live UI capture did not show the same automatic retry after a failed x4 wave.

Forward compatibility

Flow can add model ids independently of FlowKit releases. Previously an unknown model was silently replaced with GEM_PIX_2; this PR only falls back for blank/invalid ids, while a valid Flow-style wire id is preserved as requested.

Validation

  • 108 focused Flow/image tests passed
  • MV3 cold-start bootstrap test passes
  • OpenAPI schema confirms image_model, count, seed, reference_media_ids, and /api/flow/export-image
  • git diff --check clean

The repository's full test run on upstream ce37f4b still has the same unrelated pre-existing failures around processor._retry_state and result_handler fixtures (3 failed, 250 passed, 9 errors); the focused migrated Flow/image tests are green.

@crisng95

Copy link
Copy Markdown
Owner

@Bl0ck154 thank for your commits, but it has some conflict, help me fix them I will review it today

@Bl0ck154
Bl0ck154 force-pushed the feature/migrated-image-api branch from 005ad11 to b7eda7a Compare September 17, 2026 07:40
@crisng95
crisng95 merged commit a49831f into crisng95:main Sep 17, 2026
@Bl0ck154

Copy link
Copy Markdown
Contributor Author

Rebased this PR onto the current main and resolved the conflicts while preserving the newer upstream Flow/video changes. The branch is now mergeable/clean on GitHub.\n\nValidation after the rebase:\n- focused Flow/image tests: 110 passed\n- git diff --check: clean\n- Python compile checks: passed\n- node --check for the touched extension scripts: passed\n\nI also cross-checked the server checkout before resolving this: its tracked main was already fully pushed (HEAD == origin/main), so there were no unpublished code changes there to recover.

crisng95 added a commit that referenced this pull request Sep 17, 2026
First release since v1.1.0 (2026-05-09), and it is one arc: Flow moved to
flow.google.com in September 2026 and stopped minting the bearer the old REST
API needed, so the transport was rebuilt on batchexecute (#39), the dead REST
path deleted (#49), the image API migrated (#42), and the Omni image-conditioned
modes ported back on top of it (#48/#50).

Also fixes a version drift this release would otherwise have deepened. ccf89c6
put "0.2.0" in two places in agent/main.py; 939b956 bumped only the FastAPI
line, so /health has reported 0.2.0 ever since while the app said 1.1.0 — three
releases stale, on the endpoint CLAUDE.md tells you to curl before anything
else. /health now reads app.version, so there is one string to bump instead of
two literals that agree only by luck.

extension/manifest.json is deliberately not bumped. It tracks the extension's
own lifecycle, it is at 0.3.2, and a bump there forces a user-visible reload.

Verified: 272 passed; /health and app.version both report 1.2.0, checked by
calling the handler rather than reading the source.

Not verified: the Omni envelopes from #48. They are live-verified per that PR
and the tests lock their shape, but nothing has submitted through a signed-in
Flow tab since the merge resolution.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01E5BJVhNgerhFTUgmfnKTSj
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants