Python's API version number is changed when there are incompatible changes to some of the internal API calls. Python 2.4 uses a version number of 1012. Python 2.5 and later use version 1013.
You appear to be including Python 2.5 so you should get a version of 1013. The API version is defined in Include/modsupport.h. Is that file corrupt or has it been modified? Does something else override the value?