connect LEDs to USB keyboard – but they turn off after a second
Before USB enumerates the minimum current available is 100mA, you can find more information in the question How to get more than 100mA from a USB port? Because it's unlikely that the keyboard would require above 100mA I suspect it wouldn't be requesting more than 100mA so that will be the technical limit on how much you can draw when combined with the keyboard.

Without measuring the current used by the keyboard there's no sure way to know, but I'd hazard a guess at around 20mA. Although a USB compliant device shouldn't draw more than 100mA before it's been requested many PC USB controllers don't actually check / enforce that and often drawing 500mA doesn't cause a problem, even though it's not recommended.

I suspect your main problem is connecting the LEDs without a current limit resistor, that's almost always a bad idea because they like to driven by a current source rather than voltage. A yellow LED normally has a forward voltage drop of 2.1V so you'll have 4.2V for each pair of LEDs. Insert a 47 ohm resistor in series with each pair to limit the current to 20mA and I think it should solve your problem.

If you'd like to experiment with different LEDs and amounts of current there are a number of on-line LED calculators available. For example here's a LED series/parallel array wizard and the same site has a LED calculator for single LEDs.