Update api.js

Passing v and f into _api(), experimenting with prototype structure