Metadata-Version: 2.5
Name: every-other-token
Version: 0.1.0
Summary: Render per-token LLM confidence from logprobs as an HTML heatmap (Jupyter, CLI). OpenAI, vLLM and OpenAI-compatible servers.
Project-URL: Homepage, https://every-other-token.vercel.app/
Project-URL: Documentation, https://github.com/Mattbusel/Every-Other-Token/blob/main/docs/python.md
Project-URL: Source, https://github.com/Mattbusel/Every-Other-Token/tree/main/python
Project-URL: Changelog, https://github.com/Mattbusel/Every-Other-Token/blob/main/CHANGELOG.md
Author: Matthew Busel
License-Expression: MIT
License-File: LICENSE
Keywords: confidence,heatmap,interpretability,jupyter,llm,logprobs,openai,vllm
Classifier: Development Status :: 4 - Beta
Classifier: Framework :: Jupyter
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Typing :: Typed
Requires-Python: >=3.9
Provides-Extra: test
Requires-Dist: pytest>=7; extra == 'test'
Description-Content-Type: text/markdown

# every-other-token (Python)

See how sure an LLM was about every token of its answer. Ask for logprobs,
pass the response to `render()`, and get an HTML heatmap: green where the
model was confident, amber where it hesitated, red where it was guessing.
Hover a token for its probability, logprob, perplexity and the model's top
alternatives.

```python
from openai import OpenAI
from every_other_token import render

resp = OpenAI().chat.completions.create(
    model="gpt-4o-mini",
    messages=[{"role": "user", "content": "Name three moons of Jupiter."}],
    logprobs=True,
    top_logprobs=5,
)
render(resp)  # in Jupyter this displays the heatmap
```

Works with OpenAI Chat Completions and legacy Completions (SDK objects or
dicts), lists of streamed chunks, vLLM / llama.cpp / LM Studio
(OpenAI-compatible servers) and vLLM's offline `RequestOutput`. Pure Python,
no dependencies.

From the shell:

```
eot-py response.json -o heatmap.html
eot-py response.json --format text
```

Full guide: https://github.com/Mattbusel/Every-Other-Token/blob/main/docs/python.md

This is the Python companion to the
[every-other-token](https://crates.io/crates/every-other-token) Rust CLI,
which streams live from OpenAI, Anthropic, Gemini, OpenRouter and local
models. MIT licensed.
