82trust / 100

Rerank

by Rerank (Cohere-compatible) in Documents & files

x402 APIPassing, checked 3 h ago

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/rerank

Last 30 days

All checks passedSome failedAll failedNot checked
Uptime
100%
Response time
188 ms typical, 188 ms slowest 5%
Last check
3 h ago
Next check
any minute now

How to call it

# See the payment challenge (nothing is charged)
curl -i -X POST "https://agent402.tools/v1/rerank" \
  -H "content-type: application/json" \
  -d '{"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}'
import { wrapFetchWithPayment } from "@x402/fetch";
import { x402Client } from "@x402/core/client";
import { ExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";

const client = new x402Client().register(
  "eip155:8453",
  new ExactEvmScheme(privateKeyToAccount(process.env.AGENT_KEY)),
);
const pay = wrapFetchWithPayment(fetch, client);

// Not sure it's safe to pay? Preflight it first for $0.03:
// GET https://toolvet.app/api/v1/check?url=https%3A%2F%2Fagent402.tools%2Fv1%2Frerank
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
}

Example output

{
  "id": "gen-rerank-…",
  "model": "rerank-v3.5",
  "results": [
    {
      "document": {
        "text": "Paris is the capital of France."
      },
      "index": 0,
      "relevance_score": 0.89
    },
    {
      "document": {
        "text": "Berlin is the capital of Germany."
      },
      "index": 1,
      "relevance_score": 0.15
    }
  ],
  "usage": {
    "search_units": 1
  }
}

Security scan

  • No findings. We scan names, descriptions and tool definitions for hidden instructions and other prompt-injection patterns.

Recent checks

WhenResultHTTPTimePrice
3 h agoPassed402188 ms$0.002