# brainscope

An OpenAI-compatible chat server that puts any Hugging Face model behind a normal chat API while also showing a live view into what the model is doing internally as it generates a reply.

brainscope runs an OpenAI-compatible chat server over a Hugging Face model and streams a live view of its residual stream alongside the generated reply: a raw logit lens showing predictions surfacing through the layers, attention, and where each word's prediction settled. A developer can point their own app's OpenAI base_url at brainscope and watch real traffic with no code changes.

It also supports steering the model's behaviour live, by extracting a direction from contrast pairs and driving it from a slider, a per-request setting, or a tag-matched policy, following a steering spec shared with a related project. The author describes brainscope as a measuring and steering instrument rather than a source of scientific findings on its own, and it can run a small model on CPU in about thirty seconds.

Website: https://github.com/moudrkat/brainscope
