Technically the N5150M4CD is the drop-in replacement as it shares the same SMT footprint, but the N5150M8CD would also work as long as you don't mind doing the PCB change to a smaller, LGA package.
Firmware-wise, the N5 module series comes pre-loaded with an ANT SoftDevice and the network processor, so the communication over serial will operate in a similar fashion to the AP2.