Retrieval
Add/subtract/scale vectors API
Performs element-wise vector add, subtract, or scalar scale and returns the result with its magnitude. Answers 'What is a+b / a-b for these vectors?', 'How do I scale this embedding?'.
Price$0.01per request
MethodPOST
Route/v1/retrieval/vector-arithmetic
StatusLive
MIME typeapplication/json
Rate limit120/minute
Cache0s public
vectoraddsubtractscalearithmeticembeddinglinear-algebrarag
API URL
Integration docshttps://x402.hexl.dev/v1/retrieval/vector-arithmeticExample request
{
"a": [
1,
2,
3
],
"b": [
4,
5,
6
],
"op": "add"
}Example response
{
"result": [
5,
7,
9
],
"op": "add",
"dimensions": 3,
"resultMagnitude": 12.4498996
}Input schema
{
"type": "object",
"required": [
"a"
],
"properties": {
"a": {
"type": "array",
"items": {
"type": "number"
}
},
"b": {
"type": "array",
"items": {
"type": "number"
}
},
"op": {
"type": "string",
"enum": [
"add",
"subtract",
"scale"
]
},
"scalar": {
"type": "number"
}
}
}Output schema
{
"type": "object",
"additionalProperties": true
}