I've done some researches..
I'm afraid such of libraries/Apis are not available. You'll need extra devices to start measurement. Check Tom's Hardware article:
The Math Behind GPU Power Consumption And PSUs[
^]
On the other hand, i believe that you won't be able to definitely state which application consumes what portion of power. Note, that each OS run several services/processes in a background (for example: windows update). So, you can calculate power consumption for pc only, but such of calculator needs several input parameters. See:
Power Supply Calculator - The most accurate PC wattage calculator[
^]