Specifically, cantrips are level 0 spells. From the PHB:
Each spell has a level from 0 to 9. The level of a spell is a
General indicator of how powerful it is, with the humble.
(but still impressive) magic missile in 1st level and
the trembling of the earth wish at 9 Cantrips – simple but
The powerful spells that characters can cast almost from memory are level 0.
Since cantrips are spells, and Elemental Affinity allows you to add your Modification of Cha to damage when casting a spell, Elemental Affinity applies to cantrips (which make the appropriate type of elemental damage, of course).