Replicate webhooks that finish what they start.

Your handler stores the output, notifies the user, maybe chains another run. AnyHook acks Replicate at the edge, so none of that has to finish inside Replicate's delivery window.

The timing problem

Replicate fires a webhook when a model run completes. That part works fine. The problem is what you want to do with the result: persist the artefact, notify the user, fan out to a second model, post a Slack message.

Each of those is a network round-trip, and together they can outlast the request. Replicate retries, and its last retry comes about a minute after the prediction finished. Your downstream side-effects fire twice, or not at all. AnyHook fixes the timing problem at the boundary, so your handler stays linear and obvious.

60s-5min
Replicate run duration (video models)
~1 min
When Replicate sends its last retry, after the prediction completes
Replay
Re-process a past run with one click
Encrypted
Output URLs stored AES-256-GCM

Replicate completed-run callbacks via AnyHook

Pass the AnyHook inbound URL as the `webhook` parameter on your prediction. Your handler downstream gets all the time it needs to fan out.

import Replicate from "replicate";
import { verifyWebhook } from "anyhook-verify";

const replicate = new Replicate();

// 1. Start the prediction with AnyHook as the callback target.
await replicate.predictions.create({
  version: "...",
  input: { prompt: "..." },
  webhook: `https://in.anyhook.net/${userSlug}/${appSlug}`,
  webhook_events_filter: ["completed"],
});

// 2. Handler, runs after AnyHook has already acked Replicate.
export async function POST(req: Request) {
  if (!(await verifyWebhook(req, process.env.ANYHOOK_SIGNING_SECRET!))) {
    return new Response("invalid", { status: 401 });
  }

  const { id, output } = await req.json();
  await persistOutput(id, output);   //  3s
  await notifyUser(id);              //  2s
  await chainNextModel(output);      // 45s, inside even Free's 60s
  return new Response("ok", { status: 200 });
}

Questions teams ask

Does this work with all Replicate model types?
Yes, image, video, audio, language. The webhook contract is identical. AnyHook treats the payload as opaque JSON and forwards it intact.
Replicate already has retries. Why do I need AnyHook?
Replicate retries on transport failures, but its window is short and it won't retry your downstream business logic, only the webhook delivery. AnyHook retries your handler on exponential backoff, up to 10 attempts on Scale, and replays any event in one click while your plan keeps it.
Can I see the prediction output without checking Replicate again?
Yes. The full webhook payload, including the `output` URLs, is stored encrypted in your AnyHook event log: open it in the dashboard, or read it with GET /api/v1/events/{id}.
Does AnyHook verify Replicate's signature?
Yes, once you set it up. Replicate signs with the Standard Webhooks scheme (webhook-id, webhook-timestamp, webhook-signature). Set the app's source to Standard Webhooks and paste the secret from Replicate's GET /v1/webhooks/default/secret: forged requests are rejected at the edge.

Change one URL. Keep your Replicate handler.

Free tier covers 10K events / month. No SDK: point Replicate at your AnyHook inbound URL.