Skip to content

Commit 889ef91

Browse files
authored
Merge pull request #87 from ecency/fix/ai-image-idempotency-key
fix(ai-image): forward the client's idempotency_key to the upstream
2 parents b08b5b4 + 457bf60 commit 889ef91

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

dotnet/EcencyApi/Handlers/PrivateApi.Misc.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,9 @@ public static async Task AiGenerateImage(HttpContext ctx)
558558
{
559559
["us"] = username,
560560
};
561-
MiscCopyIfPresent(data, body, "prompt", "aspect_ratio", "power");
561+
// idempotency_key lets a retry recover the same paid generation instead of
562+
// charging a second one; the upstream validates its format itself.
563+
MiscCopyIfPresent(data, body, "prompt", "aspect_ratio", "power", "idempotency_key");
562564
// AI image generation legitimately takes 10-60s+; keep it long.
563565
await Upstream.Pipe(
564566
ApiClient.ApiRequest("ai-image-generate", HttpMethod.Post, null, data, null, 120000), ctx);

0 commit comments

Comments
 (0)