Skip to content

I need webhook calling feature #227

Description

@offchan42

This example code is for running SDXL from this page: https://www.baseten.co/library/stable-diffusion-xl/

const axios = require('axios');
const os = require('os');

const BASETEN_API_KEY = process.env.BASETEN_API_KEY;
const modelId = ''; // Replace with your model id

const data = {
  prompt: 'a little boy looking through a large magical portal, the boy sees a futuristic human civilization in that portal, extremely detailed, trending on artstation, 8k',
};

// Call model endpoint
axios.post(`https://model-${modelId}.api.baseten.co/production/predict`, data, {
  headers: {
    Authorization: `Api-Key ${BASETEN_API_KEY}`,
  },
})
  .then((response) => {
    const output = response.data.data;
    // Process the output as needed
    console.log('Output:', output);
  })
  .catch((error) => {
    console.error('Error:', error.message || error);
  });

I found that it's an async request that only works for long running servers. I am using Vercel and it's a serverless function that has short timeout span so I need a way to pass a webhook route to the request somehow.

I need baseten to notify my webhook route when the prediction finishes because I cannot keep polling the data on short-lived functions.

This is an example of the webhook feature from runpod: https://docs.runpod.io/serverless/endpoints/send-requests#--webhook

When can I get this feature and if not, what is the workaround?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions