Change API interfaces and rename api.py to __init__.py