I assume that the savings will be passed on to students?
This is assuming the use of gpt-4 (chatgpt would be a lot cheaper, but it doesn't follow system level instructions very consistently, often spilling answers instead of replying with feedback, hints and leading questions).
Also, projected costs per query are high because we want to feed it quite a lot of input tokens. The assignment text, the student's code as well as the reference solution code.
Something like this might work with a self-hosted (llama) model though. We do have a (small) database of student work and teacher feedback for each assignment we could use for training (privacy permitting).