How to hack the printer driver to measure the ink used for each print job?

Problem:

I have done some research and found a lack of this feature in the official software of leading inkjet printer manufacturers. measure and record the amount of ink used in each print job.

This is useful for home users and essential for commercial users to discover the real cost for each print job.

I found one by Epson (official software).

Software: https://www.epson.eu/lfp-ink-cost-calculator-app

Software Review: https://imagingspectrum.com/blog/2016/07/track-the-cost-of-print-jobs-on-epson-p-series-printers/

However, it is a closed proprietary software and a device, that is, intended only for Epson printers.

Printers are widely recognized for their excessive ink profiteers, so it is very hard to imagine that they would open their platform (API) to third-party developers.

In the spirit of the movement of manufacturers, I would like to collect more information on this area and hope to find a solution for the chosen printer.

Ideal solution:

1) Before printing: to anticipate the amount of ink to use for the print job.

2) After printing: to save the ink actually used for the print job.

3) The amount of ink used / to be used must be indicated by their color (see screenshot in the verification link).

Implementation options:

a) Piracy of the driver of the print head.

This method mainly consists of playing with the software (driver). It also takes a lot of time to dig and write the codes. But to do it at the driver level, it could potentially accomplish all # 1, # 2, and # 3. However, this method may not even be possible because printer drivers other than Epson may not be able to deal with the use of ink immediately.

b) Adopt an ink tank system and attach a "valve counter" to the tube connected to each ink cartridge.

This method is more of a hardware / electronic implementation. It can be a microcontroller / sensor at the "valve counter" to monitor the ink flow and record the ink taken from the tank. The data will be saved, manipulated and displayed on an external dashboard as we see fit. This seems to be a more rational solution in theory. However, he would not be able to accomplish # 1 (which is not a bad compromise). But this creates a unique, device-independent solution, that is, one that works virtually on any printer with an ink tank system. Huge more!

If you have any suggestions and / or know-how, I would love to hear from you and would like to see this project succeed.