Choosing series resistor for Optocoupler LED
If you want to accommodate a wide range of voltages, the easiest thing to do is to increase the resistance at the phototransistor so it will work at lower currents. I would not go over about 15mA, LEDs age and will eventually drop in brightness to the point where the CTR is not high enough to work. Speed suffers approximately proportionally, but that's not so much a concern with a manual pushbutton.
The next simplest thing is to add a constant current circuit to the input. For example:



simulate this circuit &ndash; Schematic created using CircuitLab
By adding a couple pennies worth of parts, the current is typically maintained fairly constant from about 2V to 25V (at room temperature).

In either case you want to have a lot of margin (maybe 2-3:1) to make sure the transistor saturates and to allow for normal aging. The output current is 3.3mA so if your minimum CTR is 100% you might want 10mA nominal at the LED. That would lead to excessive current with 25V in and a simple resistor R = (3.3V-1.2V)/0.01A = 210\$\Omega\$ so at 25V you'd have 108mA (but not for long).
If you allowed only 15mA at 25V in that would require about a 1.5K resistor, so the current at 3.3V would be only 1.4mA so with a CTR of 100% you'd want more like 7K at the output. Maybe 2K and 10K would be acceptable, again assuming a nominal CTR of 100% minimum over the LED current range of 1~10mA.