Webhooks
Webhooks provide real-time updates about your generation.
Specify an endpoint when you create a generation, and Luw.ai will send HTTP POST requests to that URL when the prediction is succeeded, or failed.
Here are some example scenarios where webhooks are useful:
Sending notifications when long-running generations finish. Some of our AI models like Video AI can take several minutes to run. You can use a webhook handler to send a notification like an email or a Slack message when a prediction completes.
Creating model pipelines. You can use webhooks to capture the output of one long-running prediction and pipe it into another model as input.
Note: Webhooks are great and handy, but they’re not strictly necessary to use Luw.ai API, and there are other ways to receive updates. You can also poll the results endpoint to check the status of a generation over time.
To receive webhook events, specify a webhook
URL in the request body when creating a prediction or a training. Here’s an example using the Luw.ai API to create a generation and request a webhook event when the prediction is completed or failed:
Curl Example
curl -X POST https://api.luw.ai/v2/generate \
-H "Authorization: Bearer LUW_API_TOKEN" \
-d "model=interior" \
-d "prompt=Modern minimalist living room" \
-d "image=https://example.com/room.jpg" \
-d "webhook=https://example.com/my-webhook"
💡 Tip
Add query params to your URL of webhook to pass along extra metadata, like an internal ID you are using for a prediction. For example: https://example.com/my-webhook?customId=123
Last updated