FastAPI frontends and static files, served with app.frontend() or StaticFiles, are now promoted to the Vercel CDN at build time. Requests for those paths are served directly from the CDN, without invoking your Vercel Function.
FastAPI evaluates routes in declaration order. A route declared before a StaticFiles mount takes priority over any CDN file at that path. This precedence is preserved.
Promoted source directories remain in the function bundle so the app can read from them at runtime. To exclude them and serve only from the CDN, set tool.vercel.fastapi.static.exclude = true in pyproject.toml.
Frontends guarded by dependencies are kept on the function as the CDN cannot run dependency checks. Similarly, static files which sit behind middleware are also kept on the function. To override this and always promote to CDN, set tool.vercel.fastapi.static.cdn = true. To opt out of the CDN entirely, set it to false instead.
For more information see the Vercel FastAPI documentation.