Images that have the query parameter auto set to format (see documentation) and are requested from a browser that supports the AVIF format will usually get an AVIF returned. There are a few exceptions/quirks:
In other words: if you are not seeing AVIF images being returned, don't worry — they should eventually return AVIF. You can use curl to verify the behavior:
# Replace the URL with an actual URL from your project. # Remember to include `?auto=format`! curl -sS -I \ -H 'accept: image/avif,image/webp,image/*' \ 'https://cdn.sanity.io/images/:projectId/:dataset/:filename?auto=format' \ | grep 'content-type:'
On the first request, you will likely see image/webp returned. After waiting 30 seconds, run the same command again, and you should see image/avif. If you don't, wait a little longer and retry. If you still do not see AVIF, ensure that the accept header includes image/avif (before other formats) and that the query parameters includes auto=format.
If you encounter any issues, send an email to avif@sanity.io with comprehensive details on the issue.
# Replace the URL with an actual URL from your project.
# Remember to include `?auto=format`!
curl -sS -I \
-H 'accept: image/avif,image/webp,image/*' \
'https://cdn.sanity.io/images/:projectId/:dataset/:filename?auto=format' \
| grep 'content-type:'