Rag Metrics
by denk.halowerk.com in AI models & inference
RAG evaluation without an LLM judge: context precision, context recall, faithfulness, answer relevance and correctness (lexical or embeddings), plus IR metrics (P@k, R@k, MRR, AP, nDCG) when relevant ids are known. All metrics are defined in the response. With relevant_ids: precision@k and recall@k over the first k contexts, MRR, average precision and nDCG@k with binary relevance and log2 discount.
https://denk.halowerk.com/v1/rag-metrics- Price
- $0.004
- per call in USDC
- Uptime
- 98.3%
- last 30 days
- Response time
- 158 ms
- 276 ms slowest 5%
- Last check
- Passed
- 55 min ago, next any minute now
Reliability
Status and outage history · Atom feed · Watch with other listings
How to call it
POST https://denk.halowerk.com/v1/rag-metrics
Each call costs $0.004 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://denk.halowerk.com/v1/rag-metrics
content-type: application/json
{
"answer": "The Eiffel Tower is in Paris.",
"contexts": [
"The Eiffel Tower is a landmark in Paris, completed in 1889.",
"Berlin is the capital of Germany."
],
"question": "Where is the Eiffel Tower?"
}Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
answer | string | Yes | Generated answer. |
contexts | array of string or object | Yes | Retrieved contexts in rank order: strings or objects {id, text}. |
k | integer | No | Default: 5. |
language | string | No | One of: auto, de, en. Default: "auto". |
lexical_threshold | number | No | Default: 0.6. |
method | string | No | One of: lexical, embedding, both. Default: "lexical". |
question | string | Yes | User question. |
reference | string | No | Ground-truth answer (enables context recall and correctness). |
relevant_ids | array of string | No | Ids (or 0-based positions as strings) of the truly relevant contexts. |
semantic_threshold | number | No | Cosine threshold for intfloat/multilingual-e5-small (heuristic; related pairs typically score 0.80-0.90, unrelated 0.65-0.75). Default: 0.8. |
Example response
The provider's example. We can't check it without paying.
Example response, 60 lines
{
"limitations": [
"Lexical support cannot see paraphrases; embedding similarity cannot see contradictions or negation.",
"Thresholds are heuristics; compare scores between system versions rather than reading them as absolute truth."
],
"result": {
"definitions": {
"answer_correctness_f1": "SQuAD v1.1 token F1 of answer against reference",
"answer_relevance_cosine": "cosine of question (\"query: \") and answer (\"passage: \") embeddings",
"answer_relevance_lexical": "question content terms found in the answer / question content terms",
"average_precision": "sum of precision@i at relevant ranks / number of relevant ids",
"context_precision": "mean of precision@i over the ranks i of contexts that support the reference (or the question)",
"context_recall": "reference sentences supported by some context / all reference sentences",
"faithfulness": "answer sentences supported by some context / all answer sentences",
"mrr": "1 / rank of the first relevant context (0 if none)",
"ndcg_at_k": "DCG@k / ideal DCG@k with binary gains and 1/log2(rank+1) discount",
"precision_at_k": "relevant among the first k contexts / min(k, number of contexts)",
"recall_at_k": "relevant among the first k / all relevant ids",
"support": "lexical: share of content terms of the sentence present in one context >= 0.6 and all numbers present; embedding: best cosine against the context sentences >= 0.8"
},
"details": {
"answer_sentences": [
{
"best_context": "0",
"lexical": 1,
"sentence": "The Eiffel Tower is in Paris.",
"supported": true
}
],
"context_relevance": [
{
"id": "0",
"lexical": 1,
"relevant": true
},
{
"id": "1",
"lexical": 0,
"relevant": false
}
],
"unsupported_sentences": []
},
"k": 5,
"language": "en",
"language_uncertain": false,
"method": "lexical",
"metrics": {
"answer_relevance_lexical": 1,
"context_precision": 1,
"faithfulness": 1
},
"thresholds": {
"lexical": 0.6,
"semantic": 0.8
}
},
"service": "rag-metrics",
"status": "success"
}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.004.
curl: see the payment challenge
# bash or zsh: see the payment challenge. Nothing is charged.
curl -sS -g -i -X POST 'https://denk.halowerk.com/v1/rag-metrics' \
-H 'content-type: application/json' \
--data-raw '{"answer":"The Eiffel Tower is in Paris.","contexts":["The Eiffel Tower is a landmark in Paris, completed in 1889.","Berlin is the capital of Germany."],"question":"Where is the Eiffel Tower?"}'
# 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://denk.halowerk.com/v1/rag-metrics' \
-H 'content-type: application/json' \
--data-raw '{"answer":"The Eiffel Tower is in Paris.","contexts":["The Eiffel Tower is a landmark in Paris, completed in 1889.","Berlin is the capital of Germany."],"question":"Where is the Eiffel Tower?"}' \
| 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.004 per call.
const client = new x402Client().setSpendControls({ maxAmountPerPayment: "$0.004" });
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.004 per payment. GET https://toolvet.app/api/v1/check?url=https%3A%2F%2Fdenk.halowerk.com%2Fv1%2Frag-metrics&method=POST
const res = await pay("https://denk.halowerk.com/v1/rag-metrics", {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({
"answer": "The Eiffel Tower is in Paris.",
"contexts": [
"The Eiffel Tower is a landmark in Paris, completed in 1889.",
"Berlin is the capital of Germany."
],
"question": "Where is the Eiffel Tower?"
}),
});
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.004 per call.
client = x402ClientSync().set_spend_controls({"max_amount_per_payment": "$0.004"})
register_exact_evm_client(client, EthAccountSigner(Account.from_key(os.environ["EVM_PRIVATE_KEY"])))
with x402_requests(client) as session:
res = session.post(
"https://denk.halowerk.com/v1/rag-metrics",
json={
"answer": "The Eiffel Tower is in Paris.",
"contexts": [
"The Eiffel Tower is a landmark in Paris, completed in 1889.",
"Berlin is the capital of Germany.",
],
"question": "Where is the Eiffel Tower?",
},
)
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 |
|---|---|---|---|---|
| 55 min ago | Passed | 402 | 172 ms | $0.004 |
| 14 h ago | Passed | 402 | 117 ms | $0.004 |
| 3 days ago | Timed out | - | - | - |
| 4 days ago | Passed | 402 | 39 ms | $0.004 |
| 4 days ago | Passed | 402 | 160 ms | $0.004 |
Show 10 older checks
| 5 days ago | Passed | 402 | 174 ms | $0.004 |
| 5 days ago | Passed | 402 | 123 ms | $0.004 |
| 6 days ago | Passed | 402 | 123 ms | $0.004 |
| 6 days ago | Passed | 402 | 181 ms | $0.004 |
| 6 days ago | Passed | 402 | 118 ms | $0.004 |
| 7 days ago | Passed | 402 | 790 ms | $0.004 |
| 7 days ago | Passed | 402 | 123 ms | $0.004 |
| 7 days ago | Passed | 402 | 219 ms | $0.004 |
| 7 days ago | Passed | 402 | 136 ms | $0.004 |
| 8 days ago | Passed | 402 | 168 ms | $0.004 |