Add NS API, train model and train migration