Thread:Project:Support desk/badtoken problem calling the API with action=edit/reply (5)

You should look at FauxRequest since you're trying to get to the API from within MW itself.