Compress Evaluate
by Maha Context Compiler in Search & web
Compile 1-8 documents into a token-budgeted context pack, then measure exact retention of 1-32 caller-labelled evidence spans. Returns the pack, source-linked passages, input and output hashes, original and compiled token estimates, tokensSaved, source coverage, and requiredEvidenceRetentionPercent. Retention is exact span matching only: not accuracy, answer quality, verification, or hallucination prevention. Extractive and budget-bound. Request content is not stored.
POST https://www.mahastrategies.com/api/v1/compress/evaluate
Last 30 days
- Uptime
- 100%
- Response time
- 160 ms typical, 337 ms slowest 5%
- Last check
- 4 h ago
- Next check
- any minute now
How to call it
POST https://www.mahastrategies.com/api/v1/compress/evaluate
Each call costs $0.01 in USDC on Base, paid with the request over x402.
Run a free test callOne unpaid request, the way an agent sends it. You see the payment challenge it gets back. Nothing is charged.
Example request
From the listing.
POST https://www.mahastrategies.com/api/v1/compress/evaluate
content-type: application/json
{
"budgetMode": "guaranteed",
"clientRequestId": "req_rag_release_eval_001",
"documents": [
{
"id": "release-notes",
"text": "Release may proceed after the security owner attaches credential-rotation evidence. The production canary passed in every region.\n\nRoutine notes cover staffing, dashboards, meeting cadence, maintenance calendars, regional handoffs, historical capacity, and documentation formatting.",
"title": "Release notes"
},
{
"id": "rollback-runbook",
"text": "Rollback if API errors exceed 2 percent for five minutes or payment failures breach the alert threshold. Restore the last-known-good deployment before reopening traffic.\n\nRoutine notes cover staffing, dashboards, meeting cadence, maintenance calendars, regional handoffs, historical capacity, and documentation formatting.",
"title": "Rollback runbook"
}
],
"provenance": "compact",
"requiredEvidence": [
{
"evidenceId": "release-gate",
"sourceId": "release-notes",
"text": "Release may proceed after the security owner attaches credential-rotation evidence."
},
{
"evidenceId": "rollback-trigger",
"sourceId": "rollback-runbook",
"text": "Rollback if API errors exceed 2 percent for five minutes"
},
{
"evidenceId": "handoff-note",
"sourceId": "release-notes",
"text": "regional handoffs, historical capacity, and documentation formatting"
}
],
"scoring": "bm25",
"task": "Find the release condition and rollback trigger while removing duplicate operational background.",
"tokenBudget": 128
}Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
budgetMode | string | No | One of: guaranteed, estimated. |
clientRequestId | string | Yes | |
documents | array | Yes | |
provenance | string | No | One of: full, compact, none. |
requiredEvidence | array | Yes | |
scoring | string | No | One of: bm25, keyword. |
task | string | Yes | |
tokenBudget | integer | Yes |
Example response
The provider's example. We can't check it without paying.
Example response, 109 lines
{
"clientRequestId": "req_rag_release_eval_001",
"compiledContextStored": false,
"contextPack": {
"clientRequestId": "req_rag_release_eval_001",
"context": "# Context Pack\n\nTask: Find the release condition and rollback tr…",
"includedPassages": [
{
"passageHash": "sha256:4d5e66efdcf5f8dba63a89b40af6ce17f3f42948c48b731732e47f5dc…",
"passageId": "release-notes:1",
"sourceId": "release-notes",
"text": "Release may proceed after the security owner attaches credential…"
}
],
"inputHash": "sha256:288dd5cacd92158f9460346ba6e931f6d0d52f2598bd55e748fc30a18…",
"metrics": {
"compiledBytes": 461,
"compiledEstimatedTokens": 83,
"duplicatePassagesRemoved": 1,
"estimatedReductionPercent": 14.4,
"originalBytes": 606,
"originalEstimatedTokens": 97,
"sourceCount": 2,
"sourceCoveragePercent": 100,
"tokensSaved": 14
},
"outputHash": "sha256:80a337617475688482476a469f9fa7b489ef3e1ad15b4a9756fdc1aa7…",
"packId": "ctxpack_d0dc187dd43a403d8aef472de5689408",
"retentionBoundaries": {
"claimVerificationPerformed": false,
"completenessGuaranteed": false,
"evidenceRetention": "best_effort",
"hallucinationPreventionGuaranteed": false,
"selectionType": "extractive",
"tokenCountType": "model_neutral_estimate"
},
"sources": [
{
"includedEstimatedTokens": 21,
"includedPassageIds": [
"release-notes:1"
],
"originalEstimatedTokens": 44,
"passageCount": 2,
"sourceHash": "sha256:288ded29ae161d3d11effd7161edf7c51ef1320e7ba0a8d2feaaed7ab…",
"sourceId": "release-notes",
"title": "Release notes"
}
],
"task": "Find the release condition and rollback trigger while removing d…",
"tokenBudget": 128,
"version": "0.1.0",
"warningCodes": [
"model_neutral_token_estimates",
"extractive_selection_not_verification"
],
"warnings": [
"Token counts are model-neutral estimates, not provider tokenizer…"
]
},
"evaluationId": "ctxeval_4f1c8a2b6d5e47c0913a7e2f8b46d5c1",
"evidence": [
{
"evidenceHash": "sha256:b14f15dd80d2aca98929dc3569304daf362ff8dd80549e17c4a85a55b…",
"evidenceId": "release-gate",
"sourceId": "release-notes",
"status": "retained"
}
],
"inputHash": "sha256:98eae8dca77e0c300502f19226528ef22ee2cb8f05687c3513920f91f…",
"metrics": {
"compiledBytes": 461,
"compiledEstimatedTokens": 83,
"duplicatePassagesRemoved": 1,
"estimatedReductionPercent": 14.4,
"originalBytes": 606,
"originalEstimatedTokens": 97,
"requiredEvidenceCount": 3,
"requiredEvidenceRetentionPercent": 66.7,
"retainedEvidenceCount": 2,
"sourceCount": 2,
"sourceCoveragePercent": 100,
"tokensSaved": 14
},
"offerId": "deep-context-evaluation",
"outputHash": "sha256:133714e20e990c929f2fbe4693b719cfe19254a92afd0c46ed376cae4…",
"requiredEvidenceTextStored": false,
"retentionBoundaries": {
"answerQualityAssessed": false,
"claimVerificationPerformed": false,
"completenessGuaranteed": false,
"evidenceRetention": "best_effort",
"evidenceRetentionMeasurement": "exact_span_match",
"factualAccuracyAssessed": false,
"hallucinationPreventionGuaranteed": false,
"selectionType": "extractive",
"tokenCountType": "model_neutral_estimate"
},
"sourceTextStored": false,
"version": "0.1.0",
"warningCodes": [
"model_neutral_token_estimates",
"extractive_selection_not_verification",
"exact_span_retention_not_accuracy"
],
"warnings": [
"Token counts are model-neutral estimates, not provider tokenizer…"
]
}Call it from code
The curl command shows the payment challenge. The JavaScript and Python versions pay and call, and never pay more than $0.01.
curl: see the payment challenge
# bash or zsh: see the payment challenge. Nothing is charged.
curl -sS -g -i -X POST 'https://www.mahastrategies.com/api/v1/compress/evaluate' \
-H 'content-type: application/json' \
--data-raw '{"budgetMode":"guaranteed","clientRequestId":"req_rag_release_eval_001","documents":[{"id":"release-notes","text":"Release may proceed after the security owner attaches credential-rotation evidence. The production canary passed in every region.\n\nRoutine notes cover staffing, dashboards, meeting cadence, maintenance calendars, regional handoffs, historical capacity, and documentation formatting.","title":"Release notes"},{"id":"rollback-runbook","text":"Rollback if API errors exceed 2 percent for five minutes or payment failures breach the alert threshold. Restore the last-known-good deployment before reopening traffic.\n\nRoutine notes cover staffing, dashboards, meeting cadence, maintenance calendars, regional handoffs, historical capacity, and documentation formatting.","title":"Rollback runbook"}],"provenance":"compact","requiredEvidence":[{"evidenceId":"release-gate","sourceId":"release-notes","text":"Release may proceed after the security owner attaches credential-rotation evidence."},{"evidenceId":"rollback-trigger","sourceId":"rollback-runbook","text":"Rollback if API errors exceed 2 percent for five minutes"},{"evidenceId":"handoff-note","sourceId":"release-notes","text":"regional handoffs, historical capacity, and documentation formatting"}],"scoring":"bm25","task":"Find the release condition and rollback trigger while removing duplicate operational background.","tokenBudget":128}'
# x402 v2 sends the challenge base64-encoded in the PAYMENT-REQUIRED header (v1 sends it in the body).
# To read the header:
curl -sS -g -o /dev/null -D - -X POST 'https://www.mahastrategies.com/api/v1/compress/evaluate' \
-H 'content-type: application/json' \
--data-raw '{"budgetMode":"guaranteed","clientRequestId":"req_rag_release_eval_001","documents":[{"id":"release-notes","text":"Release may proceed after the security owner attaches credential-rotation evidence. The production canary passed in every region.\n\nRoutine notes cover staffing, dashboards, meeting cadence, maintenance calendars, regional handoffs, historical capacity, and documentation formatting.","title":"Release notes"},{"id":"rollback-runbook","text":"Rollback if API errors exceed 2 percent for five minutes or payment failures breach the alert threshold. Restore the last-known-good deployment before reopening traffic.\n\nRoutine notes cover staffing, dashboards, meeting cadence, maintenance calendars, regional handoffs, historical capacity, and documentation formatting.","title":"Rollback runbook"}],"provenance":"compact","requiredEvidence":[{"evidenceId":"release-gate","sourceId":"release-notes","text":"Release may proceed after the security owner attaches credential-rotation evidence."},{"evidenceId":"rollback-trigger","sourceId":"rollback-runbook","text":"Rollback if API errors exceed 2 percent for five minutes"},{"evidenceId":"handoff-note","sourceId":"release-notes","text":"regional handoffs, historical capacity, and documentation formatting"}],"scoring":"bm25","task":"Find the release condition and rollback trigger while removing duplicate operational background.","tokenBudget":128}' \
| grep -i '^payment-required:' | cut -d' ' -f2 | tr -d '\r' | base64 --decodeJavaScript: pay and call
// npm i @x402/fetch @x402/evm viem
import { wrapFetchWithPayment, x402Client } from "@x402/fetch";
import { registerExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";
// Pays at most $0.01 per call.
const client = new x402Client().setSpendControls({ maxAmountPerPayment: "$0.01" });
registerExactEvmScheme(client, { signer: privateKeyToAccount(process.env.EVM_PRIVATE_KEY) });
const pay = wrapFetchWithPayment(fetch, client);
// Not sure it's safe to pay? ToolVet checks it first for $0.005. Pay for that from a separate
// client: this one is capped at $0.01 per payment. GET https://toolvet.app/api/v1/check?url=https%3A%2F%2Fwww.mahastrategies.com%2Fapi%2Fv1%2Fcompress%2Fevaluate&method=POST
const res = await pay("https://www.mahastrategies.com/api/v1/compress/evaluate", {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({
"budgetMode": "guaranteed",
"clientRequestId": "req_rag_release_eval_001",
"documents": [
{
"id": "release-notes",
"text": "Release may proceed after the security owner attaches credential-rotation evidence. The production canary passed in every region.\n\nRoutine notes cover staffing, dashboards, meeting cadence, maintenance calendars, regional handoffs, historical capacity, and documentation formatting.",
"title": "Release notes"
},
{
"id": "rollback-runbook",
"text": "Rollback if API errors exceed 2 percent for five minutes or payment failures breach the alert threshold. Restore the last-known-good deployment before reopening traffic.\n\nRoutine notes cover staffing, dashboards, meeting cadence, maintenance calendars, regional handoffs, historical capacity, and documentation formatting.",
"title": "Rollback runbook"
}
],
"provenance": "compact",
"requiredEvidence": [
{
"evidenceId": "release-gate",
"sourceId": "release-notes",
"text": "Release may proceed after the security owner attaches credential-rotation evidence."
},
{
"evidenceId": "rollback-trigger",
"sourceId": "rollback-runbook",
"text": "Rollback if API errors exceed 2 percent for five minutes"
},
{
"evidenceId": "handoff-note",
"sourceId": "release-notes",
"text": "regional handoffs, historical capacity, and documentation formatting"
}
],
"scoring": "bm25",
"task": "Find the release condition and rollback trigger while removing duplicate operational background.",
"tokenBudget": 128
}),
});
console.log(res.status, await res.text());Python: pay and call
# pip install "x402[requests,evm]"
import os
from eth_account import Account
from x402 import x402ClientSync
from x402.http.clients import x402_requests
from x402.mechanisms.evm import EthAccountSigner
from x402.mechanisms.evm.exact.register import register_exact_evm_client
# Pays at most $0.01 per call.
client = x402ClientSync().set_spend_controls({"max_amount_per_payment": "$0.01"})
register_exact_evm_client(client, EthAccountSigner(Account.from_key(os.environ["EVM_PRIVATE_KEY"])))
with x402_requests(client) as session:
res = session.post(
"https://www.mahastrategies.com/api/v1/compress/evaluate",
json={
"budgetMode": "guaranteed",
"clientRequestId": "req_rag_release_eval_001",
"documents": [
{
"id": "release-notes",
"text": "Release may proceed after the security owner attaches credential-rotation evidence. The production canary passed in every region.\n\nRoutine notes cover staffing, dashboards, meeting cadence, maintenance calendars, regional handoffs, historical capacity, and documentation formatting.",
"title": "Release notes",
},
{
"id": "rollback-runbook",
"text": "Rollback if API errors exceed 2 percent for five minutes or payment failures breach the alert threshold. Restore the last-known-good deployment before reopening traffic.\n\nRoutine notes cover staffing, dashboards, meeting cadence, maintenance calendars, regional handoffs, historical capacity, and documentation formatting.",
"title": "Rollback runbook",
},
],
"provenance": "compact",
"requiredEvidence": [
{
"evidenceId": "release-gate",
"sourceId": "release-notes",
"text": "Release may proceed after the security owner attaches credential-rotation evidence.",
},
{
"evidenceId": "rollback-trigger",
"sourceId": "rollback-runbook",
"text": "Rollback if API errors exceed 2 percent for five minutes",
},
{
"evidenceId": "handoff-note",
"sourceId": "release-notes",
"text": "regional handoffs, historical capacity, and documentation formatting",
},
],
"scoring": "bm25",
"task": "Find the release condition and rollback trigger while removing duplicate operational background.",
"tokenBudget": 128,
},
)
print(res.status_code, res.text)Security scan
- No findings. We scan names, descriptions and tool definitions for hidden instructions and other prompt-injection patterns.
Recent checks
| When | Result | HTTP | Time | Price |
|---|---|---|---|---|
| 4 h ago | Passed | 402 | 145 ms | $0.01 |
| 7 h ago | Passed | 402 | 126 ms | $0.01 |
| 11 h ago | Passed | 402 | 122 ms | $0.01 |
| 15 h ago | Passed | 402 | 195 ms | $0.01 |
| 19 h ago | Passed | 402 | 316 ms | $0.01 |
| 23 h ago | Passed | 402 | 117 ms | $0.01 |
| 26 h ago | Passed | 402 | 94 ms | $0.01 |
| 30 h ago | Passed | 402 | 160 ms | $0.01 |
| 33 h ago | Passed | 402 | 289 ms | $0.01 |
| 37 h ago | Passed | 402 | 229 ms | $0.01 |
| 41 h ago | Passed | 402 | 189 ms | $0.01 |
| 44 h ago | Passed | 402 | 337 ms | $0.01 |
| 2 days ago | Passed | 402 | 311 ms | $0.01 |
| 2 days ago | Passed | 402 | 119 ms | $0.01 |
| 2 days ago | Passed | 402 | 301 ms | $0.01 |