Skip to main content
POST
cURL
Relace Compact can process agent traces at >50k tok/s, enabling just-in-time compaction without interrupting the user experience.

Input Formats

Send messages in any of the three standard API formats — the format is detected automatically: The compressed messages in the response come back in the same format you sent, and can replace your live message list directly.

Authorizations

Authorization
string
header
required

Relace API key Authorization header using the Bearer scheme.

Body

application/json

Agent trace to compact

messages
object[]
required

The agent trace to compact, in OpenAI Chat Completions, OpenAI Responses, or Anthropic Messages format. The format is detected automatically, and the compressed trace is returned in the same format.

target_tokens
integer

Approximate token budget for the retained context, in your agent model's tokens. Defaults to 96k tokens. Counts are computed with a heuristic lookup table to reduce API latency; your provider's count may differ slightly.

agent_model
string

The model that generated the trace, as its API model id (e.g. claude-fable-5, gpt-5.5, grok-4.5). Relace uses this to apply model-specific compaction improvements and count tokens more accurately.

Response

Compressed agent trace

messages
object[]

The compressed agent trace, in the same format as the input.

usage
object

Token usage information for the request, counted in the Relace Compact tokenizer.