There is a lot of confusion because of your example sentences, which seem to be drawing attention away from the issue you want to discuss.
Stay up is a phrasal verb that means stay awake or remain out of bed. If I say, "I stayed up until midnight last night," that essentially means "I went to bed at midnight last night," or, "I fell asleep at midnight last night."
So, the phrase stay up for work seems a little awkward. It's not something I would normally say, but I suppose I could contrive of a situation where I might say it. For example, let's say I know someone who is on call. They tell her, "You need to be ready to come into work if we call you. However, if we haven't called you by a certain time, you won't be called at all." If I don't know what that time is, and I'm curious, I could ask:
Until what time did you stay up for work last night?
meaning, what time were you able to finally go to bed?
Perhaps you meant "stay at work", which makes a lot more sense:
How late did you stay at work last night?
meaning, "What time did you finish work last night, and head home?"
If I wanted to express with one of those two dastardly prepositions (by or until), I would use until:
Until what time were you here at work last night?
Another possibility is that the person starts work at an odd time (say, 3AM). If I knew this person didn't go to sleep before starting work, I might ask:
How late did you stay up before going to work last night?
Your sentence asks about until/by + what time, but many of these questions are asked with "how long" (or "how late") instead, which is why it's hard to give you a straight answer to your question.
Here's a situation where I might use this phrasing. You and I plan to go camping this weekend. I need to get some details before we can finalize our plans. Later tonight, I'll start doing some research. That is the backdrop for this conversation:
After you figure things out, just give me a call, and let me know the plans, okay?
I can do that, but it might be kind of late before I get it figured out. Until what time can I call?
I should be up until 11; you can call me any time before then.
If I haven't heard from you by that time, I'll look for a voice mail in the morning.
Until what time can I call? is asking how late it will be before it would be considered impolite to rouse you from bed with a phone call.