Skip to main content

Cluster Messages

Messages exchanged inside relay sessions or over LAN TCP connections.

Overview

Cluster messages are the application-layer protocol of TealeNet. They are sent as JSON inside relayData payloads (WAN) or as length-prefixed JSON over persistent TCP connections (LAN).

On LAN, messages are framed with a 4-byte big-endian length prefix followed by the JSON payload bytes. On WAN, messages are JSON-encoded, optionally encrypted via Noise, then base64-encoded into the relayData.data field.

All cluster messages use the same single-key JSON format as relay messages:

{"inferenceRequest": { ...payload... }}

Message Categories

CategoryMessagesDirection
Handshakehello, helloAckBidirectional
Healthheartbeat, heartbeatAckBidirectional
InferenceinferenceRequest, inferenceChunk, inferenceComplete, inferenceErrorConsumer to provider, provider to consumer
Model SharingmodelQuery, modelQueryResponse, modelTransferRequest, modelTransferChunk, modelTransferCompleteBidirectional

Handshake

hello

Sent when a peer connection is established. Contains device information and loaded models.

{
"hello": {
"deviceInfo": {
"id": "550e8400-e29b-41d4-a716-446655440000",
"name": "Linux Server",
"hardware": {
"chipFamily": "nvidiaGPU",
"chipName": "NVIDIA RTX 4090",
"totalRAMGB": 64.0,
"gpuCoreCount": 16384,
"memoryBandwidthGBs": 1008.0,
"tier": 1,
"gpuBackend": "cuda",
"platform": "linux",
"gpuVRAMGB": 24.0
},
"registeredAt": 798134400.0,
"lastSeenAt": 798134400.0,
"isCurrentDevice": true,
"loadedModels": []
},
"protocolVersion": 1,
"clusterPasscodeHash": null,
"loadedModels": ["mlx-community/Qwen3-8B-4bit"],
"ownerUserID": null
}
}
FieldTypeDescription
deviceInfoobjectDevice identification and hardware profile
protocolVersionnumberProtocol version (currently 1)
clusterPasscodeHashstring or nullSHA-256 hash of cluster passcode (LAN clusters)
loadedModelsarrayList of model IDs currently loaded for inference
ownerUserIDstring or nullOptional owner UUID for multi-device ownership

helloAck

Sent in response to hello. Uses the same schema as hello with the responder's device information.


Health Monitoring

heartbeat

Periodic health report sent by each node.

{
"heartbeat": {
"deviceID": "550e8400-e29b-41d4-a716-446655440000",
"timestamp": 798134400.0,
"thermalLevel": "nominal",
"throttleLevel": 100,
"loadedModels": ["mlx-community/Qwen3-8B-4bit"],
"isGenerating": false,
"queueDepth": 0,
"organizationID": null,
"ownerUserID": null
}
}
FieldTypeDescription
deviceIDstringUUID of the sending device
timestampnumberApple reference date timestamp
thermalLevelstringOne of: nominal, fair, serious, critical
throttleLevelnumber0 (paused) to 100 (full speed)
loadedModelsarrayCurrently loaded model IDs
isGeneratingbooleanWhether the node is currently generating tokens
queueDepthnumberNumber of queued inference requests
organizationIDstring or nullOptional organization ID
ownerUserIDstring or nullOptional owner UUID

heartbeatAck

Sent in response to heartbeat. Same schema, with the responder's health data.


Inference

inferenceRequest

Request inference from a provider. The request field is an OpenAI-compatible ChatCompletionRequest.

{
"inferenceRequest": {
"requestID": "550e8400-e29b-41d4-a716-446655440000",
"request": {
"model": "mlx-community/Qwen3-8B-4bit",
"messages": [
{"role": "system", "content": "You are helpful."},
{"role": "user", "content": "Hello"}
],
"temperature": 0.7,
"top_p": 0.9,
"max_tokens": 2048,
"stream": true
},
"streaming": true
}
}
FieldTypeDescription
requestIDstringUUID identifying this inference request
requestobjectOpenAI-compatible ChatCompletionRequest
streamingbooleanWhether to stream response chunks

inferenceChunk

A single streamed token or chunk from the provider.

{
"inferenceChunk": {
"requestID": "550e8400-...",
"chunk": {
"id": "chatcmpl-xxx",
"object": "chat.completion.chunk",
"created": 1713100000,
"model": "mlx-community/Qwen3-8B-4bit",
"choices": [
{
"index": 0,
"delta": { "content": "Hello" },
"finish_reason": null
}
]
}
}
}

The chunk field is an OpenAI-compatible ChatCompletionChunk.

inferenceComplete

Signals that all chunks have been sent for a request.

{
"inferenceComplete": {
"requestID": "550e8400-..."
}
}

inferenceError

Signals that inference failed for a request.

{
"inferenceError": {
"requestID": "550e8400-...",
"errorMessage": "Model not loaded"
}
}

Model Sharing

Peer-to-peer model transfer for distributing models across the network.

modelQuery

Ask a peer if they have a specific model available for transfer.

{
"modelQuery": {
"modelID": "mlx-community/Qwen3-8B-4bit"
}
}

modelQueryResponse

Response indicating model availability and size.

{
"modelQueryResponse": {
"modelID": "mlx-community/Qwen3-8B-4bit",
"available": true,
"totalSizeBytes": 4831838208
}
}

modelTransferRequest

Request to begin transferring a model.

{
"modelTransferRequest": {
"transferID": "550e8400-...",
"modelID": "mlx-community/Qwen3-8B-4bit"
}
}

modelTransferChunk

A chunk of model data. Models are transferred in 1 MB chunks.

{
"modelTransferChunk": {
"transferID": "550e8400-...",
"fileName": "model.safetensors",
"offset": 0,
"data": "base64-encoded-bytes",
"isLastChunk": false
}
}
FieldTypeDescription
transferIDstringUUID identifying this transfer
fileNamestringName of the file being transferred
offsetnumberByte offset within the file
datastringBase64-encoded chunk data (~1 MB)
isLastChunkbooleanWhether this is the last chunk for this file

modelTransferComplete

Signals that all files for a model have been transferred.

{
"modelTransferComplete": {
"transferID": "550e8400-...",
"modelID": "mlx-community/Qwen3-8B-4bit"
}
}