BPMN model API generated file invalid

Indeed you’re correct, the model API doesn’t create any DI - in fact it’s not really intended for building models to be displayed in the modeler.

But luckily our very own @Beagler has kindly built a very useful tool that can help you build the DI you can check it out here. BPMN <bpmndi> generator utility