I second all that Petunia said! Not a nutrition expert personally, but from what I've read on rat nutrition I agree.
On the topic of guinea pig food, I know some people use guinea pig / rabbit food as rat bedding because rats typically won't eat that stuff, aside from a few little tastes. I have also read that rats can't digest alfalfa. From my understanding, that's an issue because it's too much fiber for rats, and they won't get many nutrients from it. My doctor explained to me that fiber is something we can't digest, so our digestive system dilutes it with water to help it pass (hence why eating fiber helps with constipation). I think the same goes for other mammals that can't digest fiber, too? Overall, I agree that it doesn't seem worth the experiment on rats, lol, though I have used it as rat bedding with no known issues.
Another major thing about nutrition: variety. Formulated rat blocks are designed to give the exact nutrition needed for rats. Without that, I'd think the best way to get those vitamins is to feed a huge variety of healthy foods. When you think about it, we as humans don't eat 1 food as our staple. Instead we eat a bunch of foods that balance out into a complete nutrition (at least, we try).
So yep, grains and veggies are key. Maybe some lower sugar fruits?
In general, here are some veggies/fruits I give my rats: tomato, cucumber, lettuce (darker stuff, I often buy a mix of prewashed stuff), carrot, peas (easy to keep on hand if you buy them frozen), banana (higher in sugar so don't feed too much), plain pumpkin (easy around autumn time to buy an edible one, cook and freeze the mush), plain cooked squash, cooked sweet potato, broccoli, berries (my rats don't like them too much though), sweet corn (the fresh type that humans eat), watermelon and other melons, apples. There are a ton more, I just know my rats like these!
Grains are awesome too, but I'm not super knowledgeable about which ones are best. I will give oatmeal (cooked with water), baby food cereals (mixed with water), and sometimes rice if I cook it, often the more exotic rice types like 'black rice'. I find it tastes better than brown rice, and seems even healthier (insanely more expensive though).
Gah, sorry for the long reply! Again, to clarify I'm not a super expert. If an admin disagrees with what I said, they are probably right. Just felt the need to add this.