Rerank documents against a query over x402
agent402.tools/v1/rerank
Rerank documents against a query over x402 - the Cohere /rerank wire ({query, documents[], top_n} -> results with relevance_score), served by cohere/rerank-v3.5, $0.002 per call in USDC, no API key, no signup. Up to 50 documents (1,600 chars each, 40k total) and a 500-char query per call.
POST
https://agent402.tools/v1/rerankUptime100% of 1 check 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
import { createPayer } from "fourohtwo";
// One agent key pays USDC on Base or USDG on Robinhood Chain,
// inside the spending rules you set on Fourohtwo.
const pay = createPayer({ privateKey: process.env.AGENT_KEY });
const res = await pay("https://agent402.tools/v1/rerank", {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({"documents":["Paris is the capital of France.","Berlin is the capital of Germany.","Madrid is in Spain."],"query":"What is the capital of France?","top_n":2}),
});
console.log(await res.json());Example input
{
"documents": [
"Paris is the capital of France.",
"Berlin is the capital of Germany.",
"Madrid is in Spain."
],
"query": "What is the capital of France?",
"top_n": 2
}