We first generalize a result by Bavula on the sl (2) cohomology to the osp(1 vertical bar 2) cohomology and then we entirely compute the cohomology for a natural class of osp(1 vertical bar 2) modules M. We study the restriction to the sl (2) cohomology of M and apply our results to the module M = D(lambda,mu) of differential operators on the superline acting on densities. (C) 2010 American Institute of Physics. [doi:10.1063/1.3490194]