agents.writerslogic.com/api/v1/context-pack
Chooses which context items an agent should put into a prompt without exceeding a token budget: every mandatory item and everything it depends on is always included, then optional items by descending priority (each with the dependencies it pulls in) while they fit. Token counts come from the caller or from o200k_base / cl100k_base; any other tokenizer name returns unsupported (there is no Claude t
POST
https://agents.writerslogic.com/api/v1/context-packUptime100% of 3 checks in 30 days
30 days agoToday
Try it
Pays from your browser wallet in USDC on Base or USDG on Robinhood Chain, whichever the endpoint takes. The provider is paid directly; failed calls aren't refunded by Fourohtwo.
The response shows up here.
Call it from an agent
// npm install fourohtwo
import { createPayer } from "fourohtwo";
// One agent key pays USDC on Base or USDG on Robinhood Chain, inside your spending rules.
const pay = createPayer({ privateKey: process.env.AGENT_KEY, maxPerCallUsd: "0.05" });
const res = await pay("https://agents.writerslogic.com/api/v1/context-pack", {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({"items":[{"id":"system","tokens":300,"mandatory":true},{"id":"schema","tokens":500,"priority":5,"dependsOn":["system"]},{"id":"history","tokens":4000,"priority":1},{"id":"notes","text":"Customer prefers email.","priority":3}],"budget":1000,"tokenizer":"o200k_base"}),
});
console.log(await res.json());Example input
{
"items": [
{
"id": "system",
"tokens": 300,
"mandatory": true
},
{
"id": "schema",
"tokens": 500,
"priority": 5,
"dependsOn": [
"system"
]
},
{
"id": "history",
"tokens": 4000,
"priority": 1
},
{
"id": "notes",
"text": "Customer prefers email.",
"priority": 3
}
],
"budget": 1000,
"tokenizer": "o200k_base"
}