I think you can completely remove api.js and ForeignApi.js, I upstreamed the remaining bits of their functionality recently.
- CentralAuth handling: see T66636
- Handling booleans and arrays in #get/#post: arrays were done a long time ago in b69cc869119bcb5d7e21ae712bd22ab2be5907ef, did booleans too in 334e3536b26bb5a224abb7d3c0504e663c9e1171
- 'progress' events for uploads: ee7132a55208b1319a28bb85ea8aa752992e7740 (implemented differently, but should be equivalent functionality)