OpenAI · webhook reliability

OpenAI webhooks that survive a 45-second handler.

Your handler is doing real work — RAG, another model call, a DB transaction. OpenAI is waiting 10 seconds. AnyHook returns 200 in 50ms and lets your handler finish on its own time.

The timing problem

OpenAI's Assistants, Batch, and fine-tuning events all post over HTTP and expect a 2xx within roughly 10 seconds. The moment your handler does something interesting — chain a second model call, do a vector search, hit Stripe — you blow past it.

When you blow past it, OpenAI retries. Your handler runs again. Now you're paying for tokens twice and your downstream system sees duplicates. The fix is not a longer timeout; it's a separate ack-and-process pattern.

10s
OpenAI webhook response SLA
45–90s
Typical agent-in-a-handler latency
Token cost when the retry fires
50ms
AnyHook edge ack time

Drop-in replacement: change the webhook URL

Your existing handler doesn't need to change. AnyHook acks OpenAI in 50ms at the edge, then forwards the verified payload to your endpoint with full retry, replay, and event log.

// 1. Point OpenAI's webhook URL at your AnyHook inbound:
//    https://in.anyhook.net/{user-slug}/{app-slug}
//
// 2. Keep your existing handler — it now has all the time it needs.
//    AnyHook re-signs every delivery with AnyHook-Signature.

import { verifyWebhook } from "@anyhook/verify";

export async function POST(req: Request) {
  const ok = await verifyWebhook(req, process.env.ANYHOOK_SIGNING_SECRET!);
  if (!ok) return new Response("invalid signature", { status: 401 });

  const event = await req.json();

  // Run anything here. AnyHook already returned 200 to OpenAI.
  // If you fail, AnyHook retries up to 10 times with backoff.
  await ragPipeline(event.payload);     // 25s
  await secondModelCall(event.payload); // 18s
  await persistResult(event.payload);   // 2s

  return new Response("ok", { status: 200 });
}

Questions teams ask

Do I lose OpenAI's signature verification?
No. AnyHook verifies OpenAI's original signature at the edge before accepting the event, then re-signs every delivery to your endpoint with AnyHook-Signature. You verify one header instead of memorising five.
What happens if my handler is down for an hour?
AnyHook queues the event and retries on exponential backoff up to 10 times depending on your plan. Every attempt is logged and replayable from the dashboard. OpenAI sees one 200 and moves on.
Does this work with Assistants v2 streaming events?
Yes. Streaming completion events are delivered as normal webhooks once finalised. AnyHook treats them like any other event — verify, ack, fan out.

Change one URL. Keep your OpenAI handler.

Free tier covers 3K events / month. No SDK, no code changes — just point OpenAI at your AnyHook inbound URL.