in the Steam client, click on your username on the top right, select account details and go to the
purchase history license and product activations there. All your games and DLCs are listed there, as well as the way you purchased them. Now, I don't think any SteamAPI allows a site to sort through this info (hopefully ;), either you can reliably copy paste the text and try to make some script do an approximative count or... you just count them manually, which doesn't sound really practical with the number of entries involved.
Edit: actually, copypasting the whole and just looking up for a word count of "retail" gives you pretty easily the number of key activation. Same with "Steam store" for purchases, and "Gift/Guest pass" for... gifts. The only issue is that it lists both games and DLC the same way.
In my case, turns out I activated 1898 things using keys, purchased 350 things directly, and got 147 gifts.