API reference
Compact a conversation
const url = 'https://api.helping.io/v1/responses/compact';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"model":"anthropic/claude-haiku-5-5","previous_response_id":"resp_ZXhhbXBsZS9jb21wYWN0AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.helping.io/v1/responses/compact \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "model": "anthropic/claude-haiku-5-5", "previous_response_id": "resp_ZXhhbXBsZS9jb21wYWN0AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" }'Writes a summary of the conversation’s older turns, which later responses on it read in place of those turns. The most recent turns are kept in full. The response that is named must be one this key created.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”The response whose conversation to compact, and the model that writes the summary.
Compact a conversation.
Names a stored response and the model that writes the summary. The conversation the response belongs to is compacted on the server, and later responses on it read the summary in place of its older turns.
object
Not accepted: only a stored conversation, named by
previous_response_id, can be compacted.
Accepted and not applied; helpingio:warnings says so.
The model that writes the summary: from the same provider as the conversation, and one of the models allowed to compact.
The response whose conversation is compacted. Required.
Accepted and not applied.
Example
{ "model": "anthropic/claude-haiku-5-5", "previous_response_id": "resp_ZXhhbXBsZS9jb21wYWN0AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}Responses
Section titled “Responses”The compacted conversation: the compaction item, and what writing the summary used.
A compacted conversation.
output holds the one compaction item; the most recent turns stay on the
server and are still sent to the model in full, so the next request needs no
change. usage is what writing the summary used.
object
Always response.compaction.
One item of output, discriminated by type.
object
Text you are sending to the model.
object
Text the model produced.
annotations carries any citations for spans of this text.
logprobs carries per-token log probabilities; it is an empty array on
every response this surface produces today, because log probabilities
are never requested from a provider.
object
An annotation attached to a span of output text.
object
The log probability of one output token.
This surface does not produce log probabilities yet: top_logprobs is
accepted and not applied, and include: ["message.output_text.logprobs"]
is accepted and not acted on, so the logprobs arrays that carry this
type are empty on every response today. They are arrays rather than nulls
because the schema requires an array, and an empty one is the honest
answer for “none were produced”.
object
One alternative token the model considered, with its log probability.
object
Plain text, where neither direction is implied.
object
A summary of the model’s reasoning.
object
Reasoning text produced by the model.
object
The model declined to answer, and why.
object
An image you are sending to the model.
image_url accepts a URL or a data URL. detail asks for a
fidelity; omit it to let the model choose.
A file you are sending to the model, by URL or inline contents.
object
A video you are sending to the model.
object
Who a message came from.
How far along an output item is.
in_progress while the item is still being produced, completed when it
is final, and incomplete when the response stopped before the item was
finished.
One item of output, discriminated by type.
object
How far along an output item is.
in_progress while the item is still being produced, completed when it
is final, and incomplete when the response stopped before the item was
finished.
One item of output, discriminated by type.
object
Text you are sending to the model.
object
Text the model produced.
annotations carries any citations for spans of this text.
logprobs carries per-token log probabilities; it is an empty array on
every response this surface produces today, because log probabilities
are never requested from a provider.
object
An annotation attached to a span of output text.
object
The log probability of one output token.
This surface does not produce log probabilities yet: top_logprobs is
accepted and not applied, and include: ["message.output_text.logprobs"]
is accepted and not acted on, so the logprobs arrays that carry this
type are empty on every response today. They are arrays rather than nulls
because the schema requires an array, and an empty one is the honest
answer for “none were produced”.
object
One alternative token the model considered, with its log probability.
object
Plain text, where neither direction is implied.
object
A summary of the model’s reasoning.
object
Reasoning text produced by the model.
object
The model declined to answer, and why.
object
An image you are sending to the model.
image_url accepts a URL or a data URL. detail asks for a
fidelity; omit it to let the model choose.
A file you are sending to the model, by URL or inline contents.
object
A video you are sending to the model.
object
How far along an output item is.
in_progress while the item is still being produced, completed when it
is final, and incomplete when the response stopped before the item was
finished.
One item of output, discriminated by type.
object
Text you are sending to the model.
object
Text the model produced.
annotations carries any citations for spans of this text.
logprobs carries per-token log probabilities; it is an empty array on
every response this surface produces today, because log probabilities
are never requested from a provider.
object
An annotation attached to a span of output text.
object
The log probability of one output token.
This surface does not produce log probabilities yet: top_logprobs is
accepted and not applied, and include: ["message.output_text.logprobs"]
is accepted and not acted on, so the logprobs arrays that carry this
type are empty on every response today. They are arrays rather than nulls
because the schema requires an array, and an empty one is the honest
answer for “none were produced”.
object
One alternative token the model considered, with its log probability.
object
Plain text, where neither direction is implied.
object
A summary of the model’s reasoning.
object
Reasoning text produced by the model.
object
The model declined to answer, and why.
object
An image you are sending to the model.
image_url accepts a URL or a data URL. detail asks for a
fidelity; omit it to let the model choose.
A file you are sending to the model, by URL or inline contents.
object
A video you are sending to the model.
object
Text you are sending to the model.
object
Text the model produced.
annotations carries any citations for spans of this text.
logprobs carries per-token log probabilities; it is an empty array on
every response this surface produces today, because log probabilities
are never requested from a provider.
object
An annotation attached to a span of output text.
object
The log probability of one output token.
This surface does not produce log probabilities yet: top_logprobs is
accepted and not applied, and include: ["message.output_text.logprobs"]
is accepted and not acted on, so the logprobs arrays that carry this
type are empty on every response today. They are arrays rather than nulls
because the schema requires an array, and an empty one is the honest
answer for “none were produced”.
object
One alternative token the model considered, with its log probability.
object
Plain text, where neither direction is implied.
object
A summary of the model’s reasoning.
object
Reasoning text produced by the model.
object
The model declined to answer, and why.
object
An image you are sending to the model.
image_url accepts a URL or a data URL. detail asks for a
fidelity; omit it to let the model choose.
A file you are sending to the model, by URL or inline contents.
object
A video you are sending to the model.
object
One item of output, discriminated by type.
object
What this response consumed.
Present on terminal responses, including failed ones, so you can see what a failed response cost.
object
A breakdown of the input tokens counted.
Both fields are SUBSETS of input_tokens, not additions to it.
object
Input tokens written INTO the provider’s prompt cache.
A provider that does not charge for a cache write reports 0 here.
Input tokens served from the provider’s prompt cache.
A breakdown of the output tokens counted.
object
Example
{ "output": [ { "content": [ { "type": "input_text" } ], "phase": "commentary", "role": "user", "status": "in_progress", "type": "message" } ]}The body is malformed, previous_response_id is missing, input was sent, the conversation cannot be compacted or is too short to compact, or model is from another provider (the error envelope).
Missing or invalid API key (the error envelope)
The organization has no payment method on file (the error envelope).
The key is not entitled to what the request asked for (the error envelope)
No such response, or one this key cannot reach.
The named response is still in progress; a compaction of this conversation is in progress, and one that outlasted the wait keeps running and is charged; or part of the conversation was removed while it was being compacted, and helpingio:usage states the charge (the error envelope).
The organization’s credits or a spending limit refused the summary, before it started or part way, when helpingio:usage states what the calls before it were charged; or the model provider rate limited it (the error envelope).
The request could not be completed; quote the x-request-id response header when reporting it.
The model provider failed or was overloaded, or did not return a usable summary; helpingio:usage states any charge (the error envelope).
The request could not be served this instant; retry after the Retry-After header.