We use a hay rack attached to our guinea pig's cage to hold the hay. The guinea pig can eat as much and whenever it wants. Hay given every day will keep your cavy's digestive system regular, and as a general rule, you should allow your guinea pig to have as much hay as it will eat. Hay satisfies the guinea pig's natural grazing instinct and helps to keep the front teeth from overgrowing.
Timothy hay is a good type of hay to feed, though most any form of grass/hay will do. If grass hay is not available, you can feed a legume hay, such as alfalfa, though these are high in calcium and there are debates regarding whether this can lead to bladder stones.
Pellet food is the most readily available source of food for guinea pigs, it is also formulated to provide a broad range of nutrients. Pellets should be a staple in your guinea pig's diet, after hay. As stated on the care page use pellets for guinea pigs - pellets for rabbits etc. DO lack certain nutrients that guinea pigs need.
Several brands contain added nuts and sunflower seeds, which are way too high in fat and pose a serious danger: seeds, especially sunflower seeds, can cause a guinea pig to choke. Check for a manufactured date - vitamin C degrades after several months - so if you get a bag that is "old" it will not be as nutritionally good for your pet.
Fruits and Vegetables
Provide your guinea pig with fresh vegetables daily. These will provide the essential vitamin C that your pet guinea pig needs. It also provides a variety and keep your pets interest. Tend toward feeding more vegetables, with fruits sparingly in the diet. The natural sugars in fruits should not be a major part of a guinea pig's diet.
There is no rule for the amount you should feed to guinea pigs. Guinea pigs will not eat what they do not like - I was told guinea pigs love parsley - our will not even look at it when we try to feed him. Remove any uneaten fruits or veggies after about an hour so to avoid flies and rotten food. Most fresh fruits and vegetables have a high water content, so your guinea pig may drink less water than you'd expect. That is normal. If you notice diarrhea or loose stools, you're feeding a bit too much; cut out the fresh fruits and veggies for a day or two.
Try these foods for your guinea pig:
bell peppers: green, orange and red
carrots, including the green tops
Some foods that come with cautionary notes:
Apples have acids. Do not feed if you notice any mouth sores or scabs on your guinea pig's lips
Celery, cut into small pieces because "strings" can be a choking hazard; celery is a good source of water on car trips, but not a daily food
Corn husks, cut into small pieces for the same reason as celery
kale, mustard/turnip greens, and spinach contain a lot of oxalates, which can be dangerous in large amounts. This is a debated point, but it's better to just play it safe.
Melons, in small amounts, since they have an extremely high water and sugar content: cantaloupe, honeydew, watermelon.
Organic rolled oats are nice treats, mixed in with pellets, but feed sparingly due to their high fat content
Some foods to avoid completely:
cabbage, bok choy and collard greens can cause gas
potatoes are too risky, so best not to feed them to your guinea pig
nuts and seeds can splinter and puncture the throat; besides, they are way too high in fat to be part of your guinea pig's diet many raw beans and lentils are poisonous, so best not to feed any of these