In both CubeL4 and CubeF4, the USB_OTG_CfgTypeDef structure contains a ep0_mps field, with the following comment:
Set the Endpoint 0 Max Packet size. This parameter can be any value of @ref USB_EP0_MPS_
The referred USB_EP0_MPS_ constants are supposed to be defined in the same header, stm32X4xx_ll_usb.h - but they are not, and this reference leads to definition of DEP0CTL_MPS_ constants. These range from 0 to 3 representing packet sizes from 8 to 64.
The ep0_mps field is initialized by a numeric value of 0x40; and in the code is then set to either USB_OTG_FS_MAX_PACKET_SIZE (which is 64) or USB_OTG_HS_MAX_PACKET_SIZE (which is 512)...