The objects or processes that produce cosmic rays, such as supernovae, black holes, and active galactic nuclei.