Home | Specification | Test vectors | Implementations | Decisions | Participate | Source
Content-Derived Conversation Identifiers for LLM Chat APIs
Draft 0.1 of kvsig/1 · Last modified 22 November 2026
A coding agent may send hundreds of kilobytes of conversation with every turn, and most clients send no conversation identifier. A gateway in front of inference servers therefore sees a stream of unrelated requests. It cannot keep a conversation on the replica that holds its prompt cache, group requests into sessions, or tell a compaction from a new user.
kvsig specifies how to derive which conversation a stateless request belongs to from the request content itself, in a way that independent components agree on. It defines a canonical form for chat requests that does not depend on the API dialect that carried them; an exact and a loose profile; keyed identifiers (HMAC-SHA-256 under a per-deployment key) for the head, each message, each prefix and the conversation; and test vectors, so that every implementation can prove it produces the same bytes and the same identifiers.
Today, every gateway, proxy and router names the conversation its own way, and each name works only if the client sends it.
| Today | With kvsig |
|---|---|
x-session-id, x-session-token, x-litellm-session-id and others: one header per product |
One identifier, defined by an open specification |
| Works only when the client sends it; most agents send nothing | Derived from the request content; no client change |
| Agreed only between components that chose the same header | Any two components that share a deployment key agree |
| KV-aware routing hashes token blocks: tied to one engine and one tokenizer | Computed before tokenization; the same for OpenAI Chat, OpenAI Responses and Anthropic Messages |
Today With kvsig
POST /v1/messages POST /v1/messages
x-session-id: 7f3a... (if sent) (no session header)
{ "messages": [ ... ] } { "messages": [ ... ] }
gateway: route by header, gateway: conv = kvsig(body, key)
or by nothing route by conv
This is a draft. The identifiers it produces are stable: the canonical bytes and identifiers pinned by test vector set vectors/v1 do not change in any later release. The prose of the specification is not complete; until each section is written, the recorded decisions and the test vectors are normative. Version 1.0 will freeze the text after a period of use on real traffic and an outside review.
kvsig-native 0.1.0, with kvsig 0.2.0 for Python (release in progress). Component identifiers proposed (decision 0006), with a separate vector set vectors/v1-components (23 vectors). No existing identifier changes.kvsig 0.1.0 released for Python, and @kvsig/core 0.1.0 for TypeScript. Compatibility policy published. Experimental loose profile loose/2 proposed (decision 0005).vectors/v1 (232 vectors) and the conformance runner. Dialect mappings for Anthropic Messages and OpenAI Responses.| Document | Revision | Status | Formats |
|---|---|---|---|
| The kvsig/1 specification | draft 0.1 | Draft; outline | HTML, Markdown |
Test vectors vectors/v1 |
0.1 (232 vectors) | Stable | JSON, manifest |
| Design decisions 0001–0006 | — | 0001 accepted; 0002–0006 proposed | Markdown |
| Reading the identifiers | — | Informative | Markdown |
| Versioning and compatibility | draft 0.1 | Normative | HTML |
An implementation conforms when it reproduces every vector in the set it claims. The conformance runner checks any implementation through a small adapter. To have an implementation listed here, open an issue with the runner's output.
| Language | Package | Version | Role | vectors/v1 |
|---|---|---|---|---|
| Python | kvsig (PyPI) |
0.1.0; 0.2.0 in progress | Reference | 232/232, Level 3 |
| TypeScript | @kvsig/core (npm) |
0.1.0 | Independent | 232/232, Level 3 |
| Rust | kvsig-native (PyPI) |
0.1.0, release in progress | Accelerator for the Python package | 232/232, Level 3 |
Level 3 means every vector for all three dialects: OpenAI Chat Completions, OpenAI Responses and Anthropic Messages. The development versions of all three, in the repository, also pass the proposed component-identifier set vectors/v1-components.
$ pip install kvsig
from kvsig import Key, canonicalize, ids
key = Key.generate(epoch=1) # one per deployment
canon = canonicalize(request_body, "anthropic.messages")
if canon is not None: # None means "no ids"
i = ids(canon, key)
i.conv # conversation id
i.nodes[-1] # id of the whole prefix
i.sys, i.tools # the two halves of the head
gen_ai.conversation.id, which is reserved for real identifiers.Comments on the specification, the vectors and the implementations are welcome from anyone. Normative changes are open for comment for 14 days before they are accepted. Contributions require a Developer Certificate of Origin sign-off.
The specification text is licensed under Creative Commons Attribution 4.0. Code and test vectors are licensed under the Apache License 2.0. kvsig originated in the conversation-identity layer of LM Warden and is maintained here as a vendor-neutral, non-commercial project.