The only medications to treat eye infections in guinea pigs are only attainable thru veterinarians. Guinea pigs are such sensitive creatures that prolonged infections can cause them to stop eating/drinking so I wouldn't wait too long to take your little friend to the vet.
Put a few drops of colloidal silver or saline irrigation solution in the guinea pig's eye. Put ophthalmic antibiotic ointment to reduce redness in case of pea eye. It is important to confirm with your vet the right and proper dosages as well as medication as soon as possible.