yes, you can!
you do not need a canadian visa if you are still in Canada and have valid study permit.your stay is legal, but you need a canadian visa if you leave Canada and want to re-enter Canada.
since US consulate is in canada, you do not need to leave canada.