dnd 5th – Elemental Affinity allows you to add your charisma modifier to Cantrips?

Specifically, cantrips are level 0 spells. From PHB:

Each spell has a level from 0 to 9. The level of a spell is a
general indicator of his power, with the modest
(but still impressive) magic missile at the 1st level and
the earthquake wish to 9 Cantrips – simple but
powerful spells that characters can cast almost by heart – are level 0.

Since cantrips are spells and Elemental Affinity allows you to add your Cha mod to damage when you cast a spell, Elemental Affinity applies to cantrips (which inflict the appropriate elemental damage type, of course).