Yes, you can compost chillis.
Because they require such a warm climate for germination/growing on, the seeds are unlikely to grow into new plants in compost heaps in the UK but you can scoop them out before composting to save for growing on elsewhere (such as in a greenhouse or on a sunny window sill).
Fresh chilli peppers are “greens“: if you’ve got a LOT, add alongside carbon-based matter to keep the compost balanced.
If I grind up dried hot chilli peppers to add to the compost, will this discourage aphids, mites, pigeons or squirrels? These are the few pest that have bothered my balcony garden. Anything in my compost has been dried, ground, and mixed directly in the soil. The amount is generally small and well mixed in. All container gardening. There has been no dire effects from this method so far.