78trust / 100

Legacy Context Compression

by Maha Context Compiler in AI models & inference

x402 APIPassing, checked 3 h ago

Rank and pack supplied public/synthetic passages with keyword or BM25 scoring, source IDs and hashes. Token counts are model-neutral estimates, not billing or factual verification. Public/synthetic nonpersonal input only; 32 KiB input, 65 KB output. Result retention: 24 hours; minimal receipt metadata: 90 days. No model calls or factual certification.

POST
https://www.mahastrategies.com/api/v1/context/legacy/context-compression
Price
$0.035
per call in USDC
Uptime
100%
last 30 days
Response time
197 ms
277 ms slowest 5%
Last check
Passed
3 h ago, next any minute now

Run a free test callHow to call it

Reliability

All checks passedSome failedAll failedNot checked

Status and outage history · Atom feed · Watch with other listings

How to call it

POST https://www.mahastrategies.com/api/v1/context/legacy/context-compression

Each call costs $0.035001 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/context/legacy/context-compression
content-type: application/json

{
  "dataClass": "synthetic",
  "nonpersonalMetadata": true,
  "request": {
    "budgetMode": "guaranteed",
    "clientRequestId": "synthetic-batch20",
    "documents": [
      {
        "id": "doc1",
        "text": "The synthetic release requires approval from the security owner.\n\nAn unrelated synthetic scheduling note.",
        "title": "Synthetic release"
      }
    ],
    "provenance": "compact",
    "scoring": "bm25",
    "task": "Preserve the release condition and evidence source.",
    "tokenBudget": 256
  }
}

Parameters

ParameterTypeRequiredDescription
dataClassstringYes One of: public, synthetic.
nonpersonalMetadatabooleanYes
requestobjectYes

Example response

The provider's example. We can't check it without paying.

Example response, 76 lines
{
  "data": {
    "chargedAmount": "35001",
    "inputHash": "sha256:e4546790abfe5458070510a2ee58982067f9dd903318d97dd4b806b82…",
    "limitations": [
      "Public or synthetic nonpersonal input only; caller labels are no…"
    ],
    "productId": "context-compression",
    "result": {
      "contextPack": {
        "clientRequestId": "synthetic-batch20",
        "context": "# Context Pack\n\nTask: Preserve the release condition and evidenc…",
        "includedPassages": [
          {
            "passageHash": "sha256:1eb45d6ca604517d60f407452941bafb9926c8975c6dea84da2a639da…",
            "passageId": "doc1:1",
            "sourceId": "doc1",
            "text": "The synthetic release requires approval from the security owner."
          }
        ],
        "inputHash": "sha256:4c2e1ce966636cafd36bcc95211a7ef115ec9d074fd7a98c5ec6d37f4…",
        "metrics": {
          "compiledBytes": 200,
          "compiledEstimatedTokens": 39,
          "duplicatePassagesRemoved": 0,
          "estimatedReductionPercent": 0,
          "originalBytes": 105,
          "originalEstimatedTokens": 16,
          "sourceCount": 1,
          "sourceCoveragePercent": 100,
          "tokensSaved": 0
        },
        "outputHash": "sha256:bad8684935f98b379da45c12514806b9bc78b52a18bf58f040a3b968b…",
        "packId": "ctxpack_ddcfbe6ce1c300a6b16fe6a961ce41c0",
        "retentionBoundaries": {
          "claimVerificationPerformed": false,
          "completenessGuaranteed": false,
          "evidenceRetention": "best_effort",
          "hallucinationPreventionGuaranteed": false,
          "selectionType": "extractive",
          "tokenCountType": "model_neutral_estimate"
        },
        "sources": [
          {
            "includedEstimatedTokens": 16,
            "includedPassageIds": [
              "doc1:1",
              "doc1:2"
            ],
            "originalEstimatedTokens": 16,
            "passageCount": 2,
            "sourceHash": "sha256:0000f0abf18f827b3904d93cfa1a3dfb8d80240f9e0dd7205f9f30994…",
            "sourceId": "doc1",
            "title": "Synthetic release"
          }
        ],
        "task": "Preserve the release condition and evidence source.",
        "tokenBudget": 256,
        "version": "0.1.0",
        "warningCodes": [
          "model_neutral_token_estimates",
          "extractive_selection_not_verification"
        ],
        "warnings": [
          "Token counts are model-neutral estimates, not provider tokenizer…"
        ]
      }
    },
    "resultHash": "sha256:df835ad21936a0af3c6cb32cf9a6331151adc58e20c4123aa26860c64…",
    "version": "maha-reviewed-legacy-port/1"
  },
  "proof": {
    "settlement_id": "0x00000000000000000000000000000000000000000000000000000000000000…"
  },
  "success": true
}

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.035001.

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/context/legacy/context-compression' \
  -H 'content-type: application/json' \
  --data-raw '{"dataClass":"synthetic","nonpersonalMetadata":true,"request":{"budgetMode":"guaranteed","clientRequestId":"synthetic-batch20","documents":[{"id":"doc1","text":"The synthetic release requires approval from the security owner.\n\nAn unrelated synthetic scheduling note.","title":"Synthetic release"}],"provenance":"compact","scoring":"bm25","task":"Preserve the release condition and evidence source.","tokenBudget":256}}'

# 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/context/legacy/context-compression' \
  -H 'content-type: application/json' \
  --data-raw '{"dataClass":"synthetic","nonpersonalMetadata":true,"request":{"budgetMode":"guaranteed","clientRequestId":"synthetic-batch20","documents":[{"id":"doc1","text":"The synthetic release requires approval from the security owner.\n\nAn unrelated synthetic scheduling note.","title":"Synthetic release"}],"provenance":"compact","scoring":"bm25","task":"Preserve the release condition and evidence source.","tokenBudget":256}}' \
  | grep -i '^payment-required:' | cut -d' ' -f2 | tr -d '\r' | base64 --decode
JavaScript: 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.035001 per call.
const client = new x402Client().setSpendControls({ maxAmountPerPayment: "$0.035001" });
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.035001 per payment. GET https://toolvet.app/api/v1/check?url=https%3A%2F%2Fwww.mahastrategies.com%2Fapi%2Fv1%2Fcontext%2Flegacy%2Fcontext-compression&method=POST
const res = await pay("https://www.mahastrategies.com/api/v1/context/legacy/context-compression", {
  method: "POST",
  headers: { "content-type": "application/json" },
  body: JSON.stringify({
    "dataClass": "synthetic",
    "nonpersonalMetadata": true,
    "request": {
      "budgetMode": "guaranteed",
      "clientRequestId": "synthetic-batch20",
      "documents": [
        {
          "id": "doc1",
          "text": "The synthetic release requires approval from the security owner.\n\nAn unrelated synthetic scheduling note.",
          "title": "Synthetic release"
        }
      ],
      "provenance": "compact",
      "scoring": "bm25",
      "task": "Preserve the release condition and evidence source.",
      "tokenBudget": 256
    }
  }),
});
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.035001 per call.
client = x402ClientSync().set_spend_controls({"max_amount_per_payment": "$0.035001"})
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/context/legacy/context-compression",
        json={
            "dataClass": "synthetic",
            "nonpersonalMetadata": True,
            "request": {
                "budgetMode": "guaranteed",
                "clientRequestId": "synthetic-batch20",
                "documents": [
                    {
                        "id": "doc1",
                        "text": "The synthetic release requires approval from the security owner.\n\nAn unrelated synthetic scheduling note.",
                        "title": "Synthetic release",
                    },
                ],
                "provenance": "compact",
                "scoring": "bm25",
                "task": "Preserve the release condition and evidence source.",
                "tokenBudget": 256,
            },
        },
    )
    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

WhenResultHTTPTimePrice
3 h agoPassed402238 ms$0.035
8 h agoPassed402176 ms$0.035
13 h agoPassed402277 ms$0.035
18 h agoPassed402197 ms$0.035
22 h agoPassed402185 ms$0.035
Show 1 older checks
27 h agoPassed402208 ms$0.035