Manual:$wgAPIMaxUncachedDiffs

Details
The maximum number of uncached diffs that can be retrieved in one API request.

Set this to 0 to disable API diffs altogether.