Hosted layer and attachments summed when org items pulled through ArcGIS Python API. We realized this when we built this dashboard: https://www.esri.com/arcgis-blog/products/arcgis-online/administration/managing-arcgis-online-conten...
This behavior artificially inflates credit burn from hosted feature layers. Regular AGO storage is calculated at 1.2 credits per gigabyte per month whereas hosted layers are calculated at a much higher rate of .24 credits per megabyte per month. Org items pulled through Python aggregate both attachments and layer size. This results in a descrepency of over 20GB for our org in total and greater than 5k credits per month inflation in burn rate.
The standard credit status dashboard also exhibits this behavior when viewing the feature data store list or table export. This bug was identified in 2021 but has not moved from "In review" status to "under consideration". https://support.esri.com/en-us/bug/status-dashboard-for-credits-shows-combined-size-in-ite-bug-00014...