Skip to content

How can my app stop an old quote from replacing the estimate for a newer prompt?

Assign a revision number to every quote-relevant edit and accept a quote response only when that revision still matches. Aborting an earlier fetch can reduce work, but the response guard is essential. This is a client behavior you implement around AISwapLab's quote endpoint.

DESIGN A CLEAR API PRODUCT EXPERIENCEAISwapLab team · Editorial methodPublished 2 min read
Open API documentationExplore 67 Image SkillsPrivate keys · Explicit credit approval
Article workflow: Capture the revision; Check before committing; Bind the next action.
Workflow diagram: Capture the revision → Check before committing → Bind the next action. Read the article for evidence and limits.

An estimate belongs to an input

A fast typist can produce several overlapping quote requests. Network completion order does not have to match typing order. A late low estimate for a previous size must never appear beside a newer, more expensive configuration with an enabled approval button.

What to do next

  1. 01

    Capture the revision

    Increment the draft revision when model, prompt, size, duration, reference or another priced input changes. Send a frozen snapshot with its local revision rather than reading mutable editor state later.

  2. 02

    Check before committing

    When the response arrives, compare its captured revision with the current draft. Discard a mismatch, even if the HTTP request succeeded, and leave the newest estimate request responsible for the displayed price.

  3. 03

    Bind the next action

    Enable your approval action only when the displayed quote and draft share a revision. Label edits as needing a new estimate, and clear any previous approval before requesting another quote.

A concrete example

Illustrative example: revision 12 requests a square image; revision 13 changes to a larger image. Response 13 arrives first. Response 12 is ignored, so its smaller estimate cannot silently become the price shown for revision 13.

Before you call it ready

  • Delay the oldest quote until last.
  • Edit duration while an estimate is pending.
  • Confirm stale responses cannot enable approval.

When to stop or choose another method

Stop submission if the quote revision cannot be matched to the displayed input; request a fresh estimate instead.

Sources

One task. A recoverable workflow.

Check the contract, approve the quote and retain the job.

Open API documentation