Skip to main content

Module relay_endpoint

Module relay_endpoint 

Source
Expand description

The Messages API a Claude relay talks to: deterministic, no model.

A relay (crate::claude_relay) is a real Claude Code process, because only a live Claude peer’s SendMessage gets a Claude session’s reply back. What it asks its model is always the same: send the queued message. So a relay’s ANTHROPIC_BASE_URL points here, and this endpoint answers as the model would, from the relay’s own queue:

  • a send turn gets one SendMessage tool call carrying the queued to and message, byte for byte;
  • the turn after a tool result, or with nothing queued, gets RELAY_STATUS_LINE and ends.

No model runs and nothing is billed. The gate hook still checks every tool call against the queue, and the receipt is still Claude’s own SendMessage result. A relay’s API key names its directory under <mail root>/relays/.

The machine daemon’s supercode message watch child serves it on loopback, on the port recorded in <mail root>/relay-endpoint.json (a restarted server binds the same port again, so running relays keep it).

Functions§

relay_endpoint_url
The endpoint’s base URL, when it is answering.
serve_relay_endpoint
Serve the endpoint until the process ends.