Catalog/rag-euclidean-distance

Retrieval

Euclidean (L2) distance API

Returns L2 distance, squared distance, and a 1/(1+d) similarity between two vectors. Answers 'What is the Euclidean distance between these embeddings?', 'How far apart are vector a and b in L2 space?'.

Price$0.01per request
MethodPOST
Route/v1/retrieval/euclidean-distance
StatusLive
MIME typeapplication/json
Rate limit120/minute
Cache0s public
euclideanl2distancevectorembeddingmetricretrievalrag
API URLhttps://x402.hexl.dev/v1/retrieval/euclidean-distance
Integration docs
Example request
{
  "a": [
    0,
    0
  ],
  "b": [
    3,
    4
  ]
}
Example response
{
  "euclideanDistance": 5,
  "squaredEuclidean": 25,
  "similarity": 0.16666667,
  "dimensions": 2,
  "formula": "sqrt(sum((a_i - b_i)^2))"
}
Input schema
{
  "type": "object",
  "required": [
    "a",
    "b"
  ],
  "properties": {
    "a": {
      "type": "array",
      "items": {
        "type": "number"
      }
    },
    "b": {
      "type": "array",
      "items": {
        "type": "number"
      }
    }
  }
}
Output schema
{
  "type": "object",
  "additionalProperties": true
}