
Prevent double-click generation with a stable server-side operation identity, then use button disabling as a user-interface aid. A disabled button alone cannot protect against repeated requests from another tab, a retrying client, or an interrupted page. Every request for the same approved action must reach Imagild with the same saved idempotency key and parsed parameters.
Key Takeaways
- Create one operation record for the approved action before sending paid work.
- Repeated clicks should reveal the existing task, not create another operation key.
- “Generate another” is a separate explicit action with its own quote and identity.
Give the button an operation to act on
A fragile implementation generates a UUID inside every click handler. Two clicks then produce two valid keys, and the API sees two different operations. Disabling the button after the first asynchronous state update may already be too late.
Instead, let your backend create or retrieve an owned operation record for a particular draft revision and approved action. The browser receives an application operation ID, not the Imagild secret. When the user submits that action again, your backend loads the same request snapshot and remote idempotency key.
Do not use the prompt alone as a permanent deduplication key. Two intentional candidates can have identical prompts. The AWS discussion of caller intent supports distinguishing repeated fulfillment from newly requested work.
Make the UI state describe what exists
| Application state | Button behavior | Record to preserve |
|---|---|---|
| Editable draft | Show model, resolution, quote, and approval action | Draft revision |
| Submitting | Disable duplicate activation; show acknowledgment pending | Operation ID and saved request |
| Accepted | Open or reveal the existing task | Returned task ID |
| Waiting locally ended | Offer “Check existing task” | Original identity |
| Successful | Offer download and a separate new-candidate action | Output/task relationship |
| Unknown outcome | Explain reconciliation; avoid an automatic retake | Unresolved operation and diagnostics |
These labels describe your application's interface. They are not additional Imagild API status values. Use data.status and data.usage.state to populate the corresponding view.
If the user edits the prompt while the original job runs, keep those edits in a new draft. Do not let the current text area overwrite the accepted operation's payload.
Test repeated activation before allowing customer work
Use a controlled fixture server first. Give one application operation a saved key and an illustrative request. Capture outbound requests without storing a real Authorization header.
Run this acceptance sequence:
- Activate Generate twice before the first response returns.
- Confirm both backend attempts, if any, refer to the same owned operation and remote key.
- Return HTTP 202 with one task ID, then refresh the page.
- Confirm the resumed view reads that task instead of submitting a new generation.
- Open another tab for the same operation and verify it reveals existing work.
- Approve “Generate another” and confirm a new operation is created deliberately.
These are proposed checks, not a claim of completed paid testing. A separate real smoke test should have an approved budget and account.
Keep duplicate protection at the receiving boundary
Imagild reuses an accepted task for the same account, idempotency key, and parsed parameters. A changed request under that key returns a conflict. Your backend should treat that conflict as an intent mismatch, not respond by quietly generating a new key.
The API console provides the request contract. This mechanism reduces duplicate-submission risk; it does not establish global exactly-once behavior across your database, queues, browser tabs, and every external effect.
For unknown outcomes, preserve the operation and reconcile it. Re-enabling the button should not silently convert uncertainty into additional paid work.
Show the budget for deliberate new candidates
A 1K image currently uses 10 points, 2K uses 15, and 4K uses 20 across the public image choices. Display the selected tier and quote from the model market near approval. Active membership is a separate API requirement.
Use points and job planning for budget context and the failed-job decision guide for unresolved work. A good Generate button makes the user's intent visible and lets them recover existing work before spending on a new candidate.
Related tasks
- Imagild Points, Resolution and Jobs: Plan a Creation Before You Spend
- What Should You Check Before Retrying a Failed Image or Video Job?
Sources and scope
- Imagild API console: Remote key/task reuse, conflict semantics, async states and active membership.
- Imagild model market: Current image prices used in explicit user approval.
- AWS caller intent and retries: Same-looking requests can represent repeated fulfillment or distinct intentional work.
Product instructions were checked against the current Imagild API contract and the public model catalog. Code, budgets and acceptance checks are illustrative; this article does not claim a new paid generation test, an uptime measurement, a search-volume study or a ranking of AI citations.
Prepared by Imagild Editorial, the company editorial team responsible for these guides. AI assisted research and drafting. This is documentation-based guidance with proposed examples, not a claim of hands-on testing or an independent product review. Report a correction.
Cover: Original Imagild product screenshot captured on 28 October 2026; model availability and prices may change. This image is not an API response or a performance benchmark.