Firstly, without any HPI helper functions, the API currently looks like this:
var map = new ol.Map(document.getElementById('map'));
var layer = ol.Layer.createOpenStreetMap({opacity: 0.5});
map.getLayers().push(layer);
Adding a few flexibly-typed helper functions and some combined