Moved API into library

Hey,

I wanted to use the API in another library.

So I have made it into a package.

I hope this is helpful!