Context Budget Ladder
by Maha Context Budget Ladder in Search & web
Choose a context budget before an agent run. Compare five extractive compilation budgets with token estimates and source coverage. Price basis: five compiler runs, the comparison table and the receipt digest. Uses caller-supplied documents; no answer generation, factual verification or guaranteed token-billing savings.
POST https://www.mahastrategies.com/api/v1/context/budget-ladder
Last 30 days
Status and outage history · Atom feed
- Uptime
- 100%
- Response time
- 144 ms typical, 799 ms slowest 5%
- Last check
- 2 h ago
- Next check
- any minute now
How to call it
POST https://www.mahastrategies.com/api/v1/context/budget-ladder
Each call costs $0.012 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/budget-ladder
content-type: application/json
{
"budgetMode": "guaranteed",
"clientRequestId": "req_budget_ladder_001",
"documents": [
{
"id": "release",
"text": "The release may proceed only after the security owner approves the evidence packet.\n\nThe rollback begins when the error rate exceeds two percent for five minutes.\n\nRoutine status notes describe staffing and meeting schedules.",
"title": "Release rule"
},
{
"id": "operations",
"text": "The operator must preserve the request digest and approval identity.\n\nRoutine status notes describe staffing and meeting schedules.",
"title": "Operations note"
}
],
"provenance": "compact",
"scoring": "bm25",
"task": "Preserve the release authority and rollback condition.",
"tokenBudgets": [
64,
96,
128,
192,
256
]
}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. |
scoring | string | No | One of: bm25, keyword. |
task | string | Yes | |
tokenBudgets | array | Yes |
Example response
The provider's example. We can't check it without paying.
Example response, 90 lines
{
"boundaries": [
"Five deterministic compilations of the same supplied documents; …"
],
"clientRequestId": "req_budget_ladder_001",
"comparison": [
{
"compiledEstimatedTokens": 29,
"includedPassageIds": [
"operations:1"
],
"outputHash": "sha256:dc2e058d484882af8b60dd1150a0d7de0d77fb2d6e919d913c35ea2e8…",
"sourceCoveragePercent": 50,
"tokenBudget": 64,
"tokensSaved": 28
}
],
"compiledContextStored": false,
"economicBasis": {
"componentOfferId": "context-compression",
"componentPriceBaseUnits": "1000",
"componentRuns": 5,
"priceBaseUnits": "5000"
},
"inputDigest": "sha256:971bb547c8bbfb88e93cc4cd3644b476a589a60341671fe06aeee0242…",
"offerId": "context-budget-ladder",
"receiptDigest": "sha256:69cde9faca3b195bc8a1c465ce0b5309aec342e1e276bbba8b8965da4…",
"runs": [
{
"contextPack": {
"clientRequestId": "req_budget_ladder_001",
"context": "# Context Pack\n\nTask: Preserve the release authority and rollbac…",
"includedPassages": [
{
"passageHash": "sha256:60013bc3e8109806d697d7859823725653961b89f1460e2bcc9a91bc4…",
"passageId": "operations:1",
"sourceId": "operations",
"text": "The operator must preserve the request digest and approval ident…"
}
],
"inputHash": "sha256:fcf75e8713e8e458f42d7b46c9831d1407544e49df606708ba5ec2a58…",
"metrics": {
"compiledBytes": 163,
"compiledEstimatedTokens": 29,
"duplicatePassagesRemoved": 1,
"estimatedReductionPercent": 49.1,
"originalBytes": 358,
"originalEstimatedTokens": 57,
"sourceCount": 2,
"sourceCoveragePercent": 50,
"tokensSaved": 28
},
"outputHash": "sha256:dc2e058d484882af8b60dd1150a0d7de0d77fb2d6e919d913c35ea2e8…",
"packId": "ctxpack_85a631811b7f99e1e091b9f365aa6735",
"retentionBoundaries": {
"claimVerificationPerformed": false,
"completenessGuaranteed": false,
"evidenceRetention": "best_effort",
"hallucinationPreventionGuaranteed": false,
"selectionType": "extractive",
"tokenCountType": "model_neutral_estimate"
},
"sources": [
{
"includedEstimatedTokens": 0,
"includedPassageIds": [],
"originalEstimatedTokens": 37,
"passageCount": 3,
"sourceHash": "sha256:e100472342b640276bf489453adba008e167f4039a5e8202528403f3a…",
"sourceId": "release",
"title": "Release rule"
}
],
"task": "Preserve the release authority and rollback condition.",
"tokenBudget": 64,
"version": "0.1.0",
"warningCodes": [
"model_neutral_token_estimates",
"extractive_selection_not_verification"
],
"warnings": [
"Token counts are model-neutral estimates, not provider tokenizer…"
]
},
"tokenBudget": 64
}
],
"sourceTextStored": false,
"version": "0.1"
}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.012.
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/budget-ladder' \
-H 'content-type: application/json' \
--data-raw '{"budgetMode":"guaranteed","clientRequestId":"req_budget_ladder_001","documents":[{"id":"release","text":"The release may proceed only after the security owner approves the evidence packet.\n\nThe rollback begins when the error rate exceeds two percent for five minutes.\n\nRoutine status notes describe staffing and meeting schedules.","title":"Release rule"},{"id":"operations","text":"The operator must preserve the request digest and approval identity.\n\nRoutine status notes describe staffing and meeting schedules.","title":"Operations note"}],"provenance":"compact","scoring":"bm25","task":"Preserve the release authority and rollback condition.","tokenBudgets":[64,96,128,192,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/budget-ladder' \
-H 'content-type: application/json' \
--data-raw '{"budgetMode":"guaranteed","clientRequestId":"req_budget_ladder_001","documents":[{"id":"release","text":"The release may proceed only after the security owner approves the evidence packet.\n\nThe rollback begins when the error rate exceeds two percent for five minutes.\n\nRoutine status notes describe staffing and meeting schedules.","title":"Release rule"},{"id":"operations","text":"The operator must preserve the request digest and approval identity.\n\nRoutine status notes describe staffing and meeting schedules.","title":"Operations note"}],"provenance":"compact","scoring":"bm25","task":"Preserve the release authority and rollback condition.","tokenBudgets":[64,96,128,192,256]}' \
| 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.012 per call.
const client = new x402Client().setSpendControls({ maxAmountPerPayment: "$0.012" });
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.012 per payment. GET https://toolvet.app/api/v1/check?url=https%3A%2F%2Fwww.mahastrategies.com%2Fapi%2Fv1%2Fcontext%2Fbudget-ladder&method=POST
const res = await pay("https://www.mahastrategies.com/api/v1/context/budget-ladder", {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({
"budgetMode": "guaranteed",
"clientRequestId": "req_budget_ladder_001",
"documents": [
{
"id": "release",
"text": "The release may proceed only after the security owner approves the evidence packet.\n\nThe rollback begins when the error rate exceeds two percent for five minutes.\n\nRoutine status notes describe staffing and meeting schedules.",
"title": "Release rule"
},
{
"id": "operations",
"text": "The operator must preserve the request digest and approval identity.\n\nRoutine status notes describe staffing and meeting schedules.",
"title": "Operations note"
}
],
"provenance": "compact",
"scoring": "bm25",
"task": "Preserve the release authority and rollback condition.",
"tokenBudgets": [
64,
96,
128,
192,
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.012 per call.
client = x402ClientSync().set_spend_controls({"max_amount_per_payment": "$0.012"})
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/budget-ladder",
json={
"budgetMode": "guaranteed",
"clientRequestId": "req_budget_ladder_001",
"documents": [
{
"id": "release",
"text": "The release may proceed only after the security owner approves the evidence packet.\n\nThe rollback begins when the error rate exceeds two percent for five minutes.\n\nRoutine status notes describe staffing and meeting schedules.",
"title": "Release rule",
},
{
"id": "operations",
"text": "The operator must preserve the request digest and approval identity.\n\nRoutine status notes describe staffing and meeting schedules.",
"title": "Operations note",
},
],
"provenance": "compact",
"scoring": "bm25",
"task": "Preserve the release authority and rollback condition.",
"tokenBudgets": [
64,
96,
128,
192,
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
| When | Result | HTTP | Time | Price |
|---|---|---|---|---|
| 2 h ago | Passed | 402 | 87 ms | $0.012 |
| 6 h ago | Passed | 402 | 92 ms | $0.012 |
| 10 h ago | Passed | 402 | 220 ms | $0.012 |
| 13 h ago | Passed | 402 | 218 ms | $0.012 |
| 17 h ago | Passed | 402 | 140 ms | $0.012 |
| 21 h ago | Passed | 402 | 238 ms | $0.012 |
| 25 h ago | Passed | 402 | 88 ms | $0.012 |
| 28 h ago | Passed | 402 | 125 ms | $0.012 |
| 32 h ago | Passed | 402 | 103 ms | $0.012 |
| 35 h ago | Passed | 402 | 144 ms | $0.012 |
| 39 h ago | Passed | 402 | 140 ms | $0.012 |
| 42 h ago | Passed | 402 | 107 ms | $0.012 |
| 46 h ago | Passed | 402 | 176 ms | $0.012 |
| 2 days ago | Passed | 402 | 390 ms | $0.012 |
| 2 days ago | Passed | 402 | 799 ms | $0.012 |