I have a question related to Prismic API bandwidth consumption:
Let's imagine I have a small Example page component (server rendered, dynamic route) in Next.js which fetches page data on every request and renders an image from that API call within the Next Image component.
When you request a document with the Prismic client, the Content API returns the document's data, including the image URL. The bandwidth for this is relatively small, as it's just the document data, not the image itself.
The image is then delivered through Imgix, which automatically optimizes it. In your example, the original image is 5 MB, but Imgix serves it at 200 KB due to optimization. The bandwidth consumption will reflect the optimized size (200 KB), not the original.
What gets counted toward bandwidth:
Content API: The response with the document data (including the image URL).
Imgix (media bandwidth): The optimized 200 KB image is what's counted, not the original 5 MB.
When we talk about responsive sizes (src-, and srcset-tag), if I understand you right, each image version is counted also as bandwidth consumption, even if the user only needs one of them?
Good question! So, if your page isn’t fully optimized, every time it reloads or a user revisits, it might trigger the same API call for that image, which means the 5MB image is fetched each time.
But with Next Image, the image displayed is compressed to 200KB, so that's what you'd actually be using on the frontend.
Just make sure caching and optimizations are in place to avoid those repeated calls and save some bandwidth.
The bandwidth consumption is only counted for the specific image version that the user's browser selects and downloads from the srcset. The other variations listed in srcset do not contribute to bandwidth usage unless they are actually requested by the client.
So, in your example, if the browser picks just one of the eight versions, only that specific file’s size counts towards CDN bandwidth. The other seven URLs are simply options and do not generate additional bandwidth unless they are loaded separately.