As far as my knowledge goes and know about caffeine and its chemical structure. In general, caffeine is totally halal (permissible).
But if the caffeine ingredient/item is mixed with an alcoholic drink or any haram (forbidden) drinks/items, then that drink/item is haram (forbidden) to consume. Otherwise, there is no problem to consume caffeine with any halal (permissible) item/drink.
Allah (the almighty) said in the Holy Quran:
“He (Allah) has only forbidden to you dead animals, blood, the flesh of swine, and that which has been dedicated to other than Allah.”-(The Quran 16:115).
We all have a misconception that most of the foods are haram (forbidden) in Islam. It is totally wrong. All foods of/in the world are halal (permissible) to consume. Only a hand-counted few items are haram (forbidden) to consume. And those food items are definitely harmful and wrong for/to us.
So anyone should only eat halal (permissible) foods. And halal (permissible) foods are right and good to/for us.