Repository navigation
SN-2c: image generation through Gecko Suite behind AI_BACKEND - #216
Merged
Merged
Conversation
In suite mode generate_image_for_user keeps Notes' model list, size presets and per-endpoint request builder, and sends the body to the suite's fal queue instead of fal. The suite holds the key and records the billed cost; Notes polls the job, downloads the result into the user's media as before, and writes no usage. A generation that does not finish in time is cancelled so it is not billed for nobody. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01V1geD2ELWgL2sDpxYbx3Aw
davior
marked this pull request as ready for review
November 4, 2026 09:36
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Last piece of SN-2. With
AI_BACKEND=suite,generate_image_for_user(used by the image route and the assistant'sgenerate_imageaction) sends its fal request to the suite's media queue instead of to fal.localis unchanged.build_fal_image_body) stay here, as in GAM. The suite is the fal key, the queue and the bill, so no fal key is needed in Notes in this mode.POST /ai/media/jobs(kindimage), poll until it finishes, take the image URL from fal's result, then download and save it into the user's media exactly as before (stable/media/...URL, thumbnail, size cap, SSRF check).cost,currency; null when fal's price is not yet known). Notes writes no usage row; the suite has.DELETEon the job) rather than left running and billing, and answers 504. fal's own refusal reason is passed through as a 502fal_error. The suite being down is a 503suite_unavailable.Not changed: Settings → Images' fal usage and balance readouts (
/images/usage,/images/pricing) still use Notes' own fal admin/billing keys; they report Notes' own history, not the suite's.Test plan
pytest -qinbackend/: 1379 passed, 1 skipped (Python 3.13 locally; CI is 3.11). 5 new tests intests/test_suite_proxy.pythrough the real image route with a fake suite and a fake fal download: queued → running → completed, file saved in Notes' media, cost from the job, the endpoint body Notes built, no usage row and no fal key needed; a failed job keeping fal's reason; a never-finishing job cancelled with a 504; a model outside Notes' list refused without calling the suite; the suite down.Deployment
Nothing changes unless
AI_BACKEND=suiteis set (from #213).imageevent under appnoteswith a cost.AI_BACKEND=local,docker compose up -d.Generated by Claude Code