First of all, you should set the configuration setting of max number of versions to a reasonable value to clear old versions when new are created. You can do this in the CMS administration view under Config => System Settings => Editing.
I don't think that there is any API support to clear versions after changing the value, though the versions will be reduced to the max count the next time a user publishes a page. If you want to clear existing data directly in the database there is an stored procedure you can call. You will have to loop the pages and then call:
EXEC editDeleteObsoletePageVersions @PageID=@PageID, @MaxVersions=@MaxVersions