Do you have an ungolfed version? I was going to ask my LLM to make one.
https://gist.github.com/tosh/61aca9ffa9ea115fa4df332407d7a9a...
i'd move the headers out of the loop (u can prolly just hard-code it), and move context_usage to inside the if (and maybe hard-code it, too)
https://gist.github.com/tosh/61aca9ffa9ea115fa4df332407d7a9a...