I think what you are looking for is an automatic image optimisation service which are usually paid like Cloudflare Polish
which requires at least the Pro plan, transforming the raw source to webp is not a good idea, because if the user's version of the browser does not support webp literally could not see anything, also when newer formats such as AVIF become widespread you will be in a similar position, with the problem that if you have already transformed the source you will be deteriorating the image quality.
For this, as I said before, I think you should be more interested in a live service that takes care of the format transformations depending on the client requests.