| Internet-Draft | MLM Tokens over HTTP | December 2026 |
| Mekuria | Expires 7 June 2027 | [Page] |
Distributed multimodal AI applications exchange the tokens that AI models consume and produce: discrete tokens and continuous embeddings, such as the output of a vision encoder. Today these are commonly carried over HTTP as text or JSON, which adds tens to hundreds of bytes per token. This document specifies how such token streams are carried in HTTP message bodies in a compact binary form, using a media type whose parameters describe the stream. It describes the intended use cases, explains where HTTP fits, and defines the body format, its framing, and its use with HTTP/1.1, HTTP/2, and HTTP/3. No HTTP extension is needed.¶
This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79.¶
Internet-Drafts are working documents of the Internet Engineering Task Force (IETF). Note that other groups may also distribute working documents as Internet-Drafts. The list of current Internet-Drafts is at https://datatracker.ietf.org/drafts/current/.¶
Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress."¶
This Internet-Draft will expire on 4 June 2027.¶
Copyright (c) 2026 IETF Trust and the persons identified as the document authors. All rights reserved.¶
This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (https://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Revised BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Revised BSD License.¶
AI applications increasingly run as pipelines split across devices, edge, and cloud. Language models operate on sequences of tokens, and non-text inputs such as images, video, and audio reach a model in one of two forms:¶
Discrete tokens: integer indices into a learned codebook, produced by a tokenizer that quantizes the input. A discrete token is a few octets, 2 octets in the default setting.¶
Continuous embeddings: vectors, one per image patch or audio frame, produced by a modality encoder such as the vision encoder of a vision-language model (VLM). A vector ranges from a few hundred octets, after compression, to several kilobytes.¶
In split inference, part of a model runs on one device and the rest elsewhere; for example, a device runs the vision encoder of a VLM and sends the resulting embeddings, instead of the image, to the language model on a server. Models also produce tokens, such as audio tokens for speech synthesis, which are streamed to the client.¶
AI services are commonly accessed over HTTP. Current interfaces such as the OpenAI API and agent protocols such as MCP and A2A carry tokens as JSON, often streamed as Server-Sent Events, and media as base64 inside JSON ([I-D.discrete-token-transport-mlm] Section 4.5). This places tens to hundreds of bytes on the wire per token, against about 2 bytes for a discrete token in binary form ([I-D.discrete-token-transport-mlm] Section 7.5).¶
This document lets such services keep HTTP while carrying tokens in a compact binary form. It defines the use of the media type "application/mlm-tokens" in HTTP message bodies, following the guidance for building protocols on HTTP [RFC9205]. The framework document [I-D.discrete-token-transport-mlm] gives more background, measured traffic characteristics, and the transport requirements; companion documents specify carriage over RTP [I-D.rtp-payload-mlm-tokens] and MOQT [I-D.moqt-mlm-token-streams]. All three use the same unit format, so that a unit is interpreted in the same way whichever transport carries it (Section 11).¶
A client that runs a tokenizer or vision encoder locally sends the resulting tokens or embeddings to an HTTP inference endpoint instead of the image or video. The raw media then stays on the device, and with token selection and compact element formats the upload can be smaller than the compressed media ([I-D.discrete-token-transport-mlm] Section 7.3). This suits request/response and near-real-time use, for example the analysis of a short clip or of individual images.¶
A model that generates audio or other tokens returns them in the response body as they are produced, for example speech tokens that a client decodes and plays out. This is the binary counterpart of today's streaming of text tokens as Server-Sent Events.¶
Figure 1 shows the use cases above.¶
+-------------------+ +---------------------+ | Client | request body: | HTTP inference | | | tokens/embeddings | endpoint | | camera | ------------------> | | | encoder | | language model | | selection | response body: | | | player | <------------------ | token generation | | | generated tokens | | +-------------------+ +---------------------+
Either body, or both, can use the media type of this document; the other body can use any format the service defines. The media type parameters in Content-Type tell the receiver how to interpret the body (Section 6).¶
HTTP is the transport of today's AI services, so carrying tokens in HTTP bodies changes the data format without changing the deployment:¶
No new protocol. Only a media type is used; existing clients, servers, load balancers, authentication, and operations practices apply.¶
Compact data. A binary body reduces the per-token cost by one to two orders of magnitude compared with JSON and Server-Sent Events, and removes JSON serialization from the critical path.¶
Streaming in both directions. A request or response body can be sent progressively, unit by unit, with HTTP/1.1 chunked transfer coding or HTTP/2 and HTTP/3 DATA frames.¶
Reliable delivery. Data that needs every token is delivered completely and in order.¶
One connection. HTTP/3 carries several request streams over one QUIC connection, which avoids repeated connection setup and transport head-of-line blocking.¶
HTTP also has limits for real-time use: delivery is reliable, so a lost packet delays the data behind it instead of being skipped; there are no per-unit deadlines; and intermediaries do not act on the importance of individual tokens. For interactive use over lossy paths, the MOQT [I-D.moqt-mlm-token-streams] and RTP [I-D.rtp-payload-mlm-tokens] bindings may be more suitable.¶
This document specifies:¶
Media type and parameters: how the media type and its parameters in Content-Type describe a token stream, and how a server reacts to parameters it does not support (Section 6).¶
Body format and framing: a body is a sequence of AI Data Units that a receiver delimits from their headers, independently of HTTP framing (Section 7).¶
Model configuration handling (Section 10).¶
The AI Data Unit format, shared with the RTP and MOQT bindings (Section 11).¶
No HTTP extension and no new header field is defined. Not specified, and for further study: carriage of media timestamps, mechanisms for rate adaptation, and a JSON representation of the AI Data Unit for debugging. Section 12 gives examples; readers mainly interested in how the media type can be used can start with Sections 2, 3, and 12.¶
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in BCP 14 [RFC2119] [RFC8174] when, and only when, they appear in all capitals.¶
HTTP terms are used as in [RFC9110]. This document also uses the following terms (see also [I-D.discrete-token-transport-mlm]):¶
an integer index into a learned codebook.¶
a vector representing one token position in a model's input, e.g., the vision-encoder output for one image patch.¶
everything both endpoints must share to interpret the tokens: the codebook for discrete tokens; the encoder, any adapter, and any quantizer for continuous embeddings. It is opaque to this document.¶
one discrete token or one continuous embedding.¶
a header plus one or more elements that share the same handling (representation type, modality, layer, and priority). In this document an ADU is one length-delimited unit in the HTTP body (Section 7).¶
the ADUs that together carry one unit of information, e.g., all tokens of one image or frame.¶
A body that carries a token stream is labeled with the media type "application/mlm-tokens". A client requests such a body in a response with Accept and labels such a request body with Content-Type. The media type parameters describe the stream (REQ-5); they are the parameters of [I-D.rtp-payload-mlm-tokens] Section 8.2 (rtype, token-bits, emb-dim, elem-format, codebook-id) with the same values, defaults, and meanings; "rate" is not used with HTTP. For example:¶
Content-Type: application/mlm-tokens; rtype=embedding; emb-dim=1152¶
The parameters follow the media type parameter syntax of [RFC9110] Section 8.3.1. A server that does not support the requested rtype, token-bits, or elem-format MUST reject the request (with 406 when requested through Accept, or 415 for a request body). A response carries in its Content-Type the parameters that apply to its body.¶
"application/mlm-tokens" is a binary media type. It MUST be sent without a "charset" parameter, and intermediaries and clients MUST treat the body as opaque octets and MUST NOT apply any character-set or text transformation to it. A lossless Content-Encoding MAY be applied as for any HTTP body; it yields little on these payloads.¶
The body is a sequence of AI Data Units, each consisting of its header (Section 11) immediately followed by its Element Data, as raw octets; this is the same octet layout that the RTP and MOQT bindings use. In HTTP/1.1 the octets are carried with chunked transfer coding [RFC9112]; in HTTP/2 [RFC9113] and HTTP/3 [RFC9114] in DATA frames.¶
Self-delimitation: Chunk boundaries (HTTP/1.1) and DATA-frame boundaries (HTTP/2, HTTP/3) are not semantic and MAY be coalesced or split by intermediaries, so a receiver MUST NOT rely on them to delimit AI Data Units. Instead it locates the next ADU by computing the current ADU's length from its header:¶
header length = 8 + 2*C + 4*G + 2*P*(Element Count) octets
payload length = ceil(Element Count * b / 8) octets for discrete
tokens (b = token-bits, default 16), or
Element Count * W for continuous embeddings
¶
where W = 2*(integer format) + ceil(d * bits(elem-format) / 8) ([I-D.rtp-payload-mlm-tokens] Section 4.3). An end-of-group marker (T=1, Element Count=0) has no payload. Because the length is computable from the header, the body is self-delimiting as a continuous octet stream.¶
Batching (REQ-2): An ADU SHOULD carry many elements (Element Count > 1); several ADUs MAY be sent in one chunk or flush, but elements of a different layer or priority go in separate ADUs. Batching MUST NOT delay an ADU beyond the application's latency budget.¶
Positions (REQ-12): When the elements of a token group are a selected subset (e.g., selected visual tokens), every ADU of the group MUST set P=1 and list the positions of its elements.¶
No fragmentation: The HTTP body is a reliable, ordered byte stream with no packet-size limit, so F MUST be 0 and S and E are 1. Seq Start gives the index of the ADU's first element within its token group, as for the other bindings.¶
Timing (REQ-4): Order within the body provides sequencing (REQ-3); carriage of an absolute media clock and per-unit timestamp is for further study.¶
A token group is one or more ADUs that together form one unit of information (e.g., all tokens of one image). Because the HTTP body has no packet or object boundaries, a token group is identified either by a common Group Identifier (G=1, Section 11) carried in every ADU of the group, whose scope is the HTTP body, or, when no Group Identifier is used, as the run of consecutive ADUs up to and including the ADU with T=1 (or an end-of-group marker). Such a token group aligns with the 3GPP PDU Set concept; the precise mapping to PDU Sets is left for further study ([I-D.discrete-token-transport-mlm] Section 10.3).¶
End of group (REQ-13): A sender that ends a token group, including one it decides to truncate, sets T=1 on the last ADU of the group or sends an end-of-group marker (T=1, Element Count=0, with the fields of [I-D.rtp-payload-mlm-tokens] Section 4.6) carrying the group's Group Identifier, if one is used. The receiver can then start processing the group without waiting for more data.¶
End of body: The zero-length terminating chunk (HTTP/1.1) or the end of the DATA frames of the stream signals completion.¶
HTTP/1.1 relies on TCP and is subject to head-of-line blocking; it is suited to relaxed latency (batch, asynchronous) only. HTTP/2 multiplexes requests over one TCP connection but is still subject to TCP head-of-line blocking. HTTP/3 over QUIC removes transport head-of-line blocking and is RECOMMENDED for interactive and lossy-path use. Carrying the whole exchange over a single HTTP/3 connection also avoids the multiple-connection and connection-setup overhead observed for text/JSON agent transports ([I-D.discrete-token-transport-mlm] Section 7.5).¶
Multiplexing (REQ-8): A single request or response carries the token stream by default. A deployment MAY use one request per modality or representation (or, if layers are exposed, per layer) over HTTP/2 or HTTP/3, and a client MAY drop an optional one by cancelling it.¶
Priority (REQ-6): Importance is expressed per ADU by the PRI field (1 highest, 15 lowest, 0 not specified) and, where grouping is used, by a common Group Identifier. When no importance information is available, PRI is 0. Where several requests are used, a sender MAY map PRI to the urgency parameter of the HTTP prioritization scheme [RFC9218]; since PRI has 15 levels and urgency 8, the mapping is deployment-specific. This does not require a layered structure.¶
Loss and adaptation (REQ-7, REQ-13): HTTP delivers a body reliably and in order, so ADUs are not lost from within a body. Elements can be missing for other reasons, which a receiver handles as follows:¶
The sender omits elements, e.g., by token selection or by ending a group early (Section 8): the receiver uses the elements received, at their positions.¶
A separate optional request is cancelled: its elements are missing, and the other requests are unaffected.¶
The connection fails or the body ends early: the receiver uses the complete ADUs received and discards an incomplete last ADU. Continuing requires a new request; resumption mechanisms are out of scope.¶
For missing discrete tokens, the receiver conceals them and resumes at the next independently decodable unit (I=1). Because delivery is reliable, loss is not a means of adaptation; a sender facing falling throughput can send fewer elements per token group and end groups early (Section 8). How quickly AI senders can adapt, and the mechanisms for doing so, are for further study.¶
Network-visible marking (informative). Under HTTPS the body, including the AI Data Unit header, is encrypted on the path. A sender MAY map PRI to a DSCP value within an administrative domain; DSCP is commonly re-marked or ignored across the public Internet. How a 5G/6G network treats such traffic is a 3GPP matter on which this document places no requirement.¶
The model configuration -- the codebook for discrete tokens, or the encoder, adapter, and quantizer for continuous embeddings -- is opaque to this document and handled per the binding modes of [I-D.discrete-token-transport-mlm] Section 10.7:¶
Implicit (out-of-band): no codebook-id parameter; no codebook or model information on the wire; endpoints share it by construction. MUST be supported.¶
Reference: the codebook-id parameter carries an opaque identifier (for continuous embeddings, covering the vision encoder, any adapter, and any fixed quantizer); it MAY, for example, include a hash of the configuration, so that a mismatch can be detected; a hash shows that a configuration is untampered only when the expected identifier is itself authenticated or pinned. The per-unit Codebook/Model ID (C=1) MAY also be used but is not required.¶
Explicit in-band distribution of codebook or model content is out of scope.¶
Each AI Data Unit in the body uses the format shared with the RTP and MOQT bindings. The fields are defined in [I-D.rtp-payload-mlm-tokens] Section 4.2; a unit can therefore be passed between transports without re-encoding. The fixed part of the header is 8 octets; optional fields follow only when their flag is set:¶
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Ver=1 | RType |Modal. | Layer |S|E|I|C| PRI |G|X|P|T|F| Rsv | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Element Count | Seq Start | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ : Codebook/Model ID (16, iff C=1) : : Group Identifier (32, iff G=1) : : Position List (16 x Element Count, iff P=1) : : Element Data ... : +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
In summary:¶
RType: 0 for discrete tokens, 1 for continuous embeddings. Modality: e.g., 1 for video, 2 for image. Layer: optional and informational.¶
PRI: importance, 1 (highest) to 15 (lowest), 0 if not specified (Section 9).¶
Seq Start: the index of the ADU's first element within its token group. F: element fragment, MUST be 0 in this document, so S and E are 1. I: an independently decodable unit. T: end of the token group (Section 8).¶
C, G, and P: presence of the Codebook/Model ID, the Group Identifier (constant across a token group), and the Position List (the position of each element in its token group). X and Rsv are reserved.¶
Element Count: the number of elements in the ADU; 0 only in an end-of-group marker with T=1.¶
For discrete tokens, each element is a codebook index of b bits (16 by default), packed as defined in [I-D.rtp-payload-mlm-tokens] Section 4.3. For continuous embeddings, each element is one vector of dimension d in the negotiated element format, preceded by a scale for integer formats ([I-D.rtp-payload-mlm-tokens] Section 4.3). Only the header fields are meaningful to the transport; elements and positions are opaque, interpretable only by an endpoint holding the codebook or model.¶
The following examples illustrate the use of the media type. The paths, sizes, and values are example values, not recommendations; header lines folded for display are a single line in practice. The AI Data Unit layouts themselves are illustrated in [I-D.discrete-token-transport-mlm] Section 10.10.¶
Example 1: uploading embeddings instead of an image. A client runs a vision encoder and an adapter, keeps the 64 most important tokens of an image, and uploads them to an inference endpoint:¶
POST /v1/analyze HTTP/1.1
Host: inference.example.com
Content-Type: application/mlm-tokens; rtype=embedding;
emb-dim=256; elem-format=int8
Transfer-Encoding: chunked
¶
The body is 16 ADUs of four elements each, with their positions (P=1), 1048 octets per ADU and about 16.5 KB in total. The ADUs carry Seq Start 0, 4, 8, ..., and the last ADU has T=1; no Group Identifier is needed, since the group ends with that ADU. The response, e.g., a text answer, uses whatever format the service defines.¶
Example 2: streaming generated speech tokens. A client asks a speech model for synthesized speech as discrete tokens:¶
POST /v1/speak HTTP/1.1 Host: inference.example.com Accept: application/mlm-tokens; rtype=token¶
The server responds with "Content-Type: application/mlm-tokens; rtype=token" and sends one ADU every 200 ms, each carrying the tokens produced in that interval, flushing each ADU as it is produced. The client decodes and plays out the tokens as they arrive; the end of the body ends the stream.¶
Example 3: unsupported parameters. If the client of Example 1 sends "elem-format=int4" to a server that supports only "bf16" and "int8", the server rejects the request with 415 (Unsupported Media Type), and the client can retry with a supported format.¶
All endpoints MUST use HTTPS (TLS 1.3 RECOMMENDED); plain HTTP MUST NOT be used in production. Discrete tokens and continuous embeddings inherit the sensitivity of the source data (reconstruction from codebook, embedding inversion; see [I-D.discrete-token-transport-mlm] Section 11), so access control for the source media applies to these endpoints, including when only vision-encoder embeddings rather than images are uploaded. Server authentication counters adversarial injection; servers accepting embedding uploads SHOULD authenticate clients. Receivers MUST bound the resources committed per token group. The media type parameters are visible to any intermediary that terminates TLS; terminate TLS close to the client where modality or session identity is sensitive. Keeping the codebook or model out of band (Section 10) reduces model-fingerprint exposure; an identifier that includes a hash of the configuration allows a mismatch to be detected without disclosing the configuration, and a tampered configuration to be detected when the expected identifier is authenticated or pinned. A hash supplied or modified together with the configuration does not by itself authenticate it.¶
The media type "application/mlm-tokens" is registered by [I-D.rtp-payload-mlm-tokens]; this document defines its use, with the parameters of Section 6, as an HTTP message body (Section 7). This document has no further IANA actions. The Representation Type and Modality registries shared by the bindings are requested by [I-D.rtp-payload-mlm-tokens].¶
Mapping to the requirements of [I-D.discrete-token-transport-mlm]:¶
REQ-1 Low latency HTTP/3 streaming; flush per unit; MOQT/RTP
may suit lossy real-time paths better.
REQ-2 Batching/compact Many elements per ADU; several ADUs per
chunk; b-bit tokens, quantized embedding
formats; binary body (Section 7).
REQ-3 Sequencing Body order + Seq Start.
REQ-4 Timestamping Not provided: body order only; media
clock for further study.
REQ-5 Metadata Media type parameters in Content-Type
(Section 6).
REQ-6 Priority Per-unit PRI (+ optional Group Identifier);
optional RFC 9218 urgency across requests
(Section 9).
REQ-7 Partial reliab. Reliable body; omitted elements handled by
concealment or proceed-with-received;
cancel optional requests (Section 9).
REQ-8 Multiplexing Single request by default; one request per
track optional (HTTP/2, HTTP/3).
REQ-9 Security HTTPS (TLS 1.3) (Section 13).
REQ-10 Codebook agree. Opaque, out-of-band by default
(Section 10).
REQ-11 Rep-type signal RType field / "rtype" parameter.
REQ-12 Positions Position List (P flag) (Section 7).
REQ-13 Adaptation T flag / end-of-group marker (Section 8);
rate adaptation for further study.
¶