The major role in maintaining food and energy levels in an ecosystem is played by:
Autotrophs
Organisms in an ecosystem that produce complex organic compounds from simple substances present in its surroundings are called autotrophs. In almost all cases, these are photosynthetically active organisms (plants, cyanobacteria and a number of other unicellular organisms).