This answer is OBSOLETE. The Pi 3.3V rail is widely assumed to provide 50mA, but this is not officially documented for recent Pi models. The original Pi has an on-board linear regulator which was limited, but the B+ and later have a switch mode regulator which can supply more. The regulator chip (which supplies both 3.3V and 1.8V) is rated at 1A. Raspberry Pi Power Limitations
A maximum of 16mA per pin with the total current from all pins not
From the Gert himself!
So, if your project is only using 4 pins, make sure that your current settings do no exceed the 16mA per pin and all driven together don't exceed the total of 51mA. I believe that the 16mA is also configurable somewhere.
Generally, you should be using a buffer of sorts or a transistor to drive things like LEDs or relays. If you have a bit of a wiring problem or component failure, your board and or CPU may let out the magic smoke.
I know HP used to make some marvelous low current LEDs back in the day. They used to need 2mA of current and a forward voltage for their red one of around 2V, so you would need a small resistor to limit its current consumption and protect the CPU pin.
I see Vishay have a similar type device, and I suppose Kingbright do too.
To calculate the current limiting resistor:
resVal = (Vsupply - VforwardLED)/currentLimit
so... for a 3.3V RPi pin, LED spec says 2V, our limit is 2mA, we get:
resVal = (3.3 - 2)/0.002
resVal = 650 Ohms
Safely round that up to the closest E12/E24 resistor value of 680 Ohms
Here is the values table and color codes if needed.
Enjoy your RPi! Everything should have more LEDS!