Generate Text Embedding
curl --request POST \
--url https://mavi-backend.memories.ai/serve/api/v2/embeddings/text \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"input": [
"Sample text to embed",
"Another text string"
],
"model": "gemini-embedding-001",
"dimensionality": 512
}
'import requests
url = "https://mavi-backend.memories.ai/serve/api/v2/embeddings/text"
payload = {
"input": ["Sample text to embed", "Another text string"],
"model": "gemini-embedding-001",
"dimensionality": 512
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
input: ['Sample text to embed', 'Another text string'],
model: 'gemini-embedding-001',
dimensionality: 512
})
};
fetch('https://mavi-backend.memories.ai/serve/api/v2/embeddings/text', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://mavi-backend.memories.ai/serve/api/v2/embeddings/text",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'input' => [
'Sample text to embed',
'Another text string'
],
'model' => 'gemini-embedding-001',
'dimensionality' => 512
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://mavi-backend.memories.ai/serve/api/v2/embeddings/text"
payload := strings.NewReader("{\n \"input\": [\n \"Sample text to embed\",\n \"Another text string\"\n ],\n \"model\": \"gemini-embedding-001\",\n \"dimensionality\": 512\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://mavi-backend.memories.ai/serve/api/v2/embeddings/text")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"input\": [\n \"Sample text to embed\",\n \"Another text string\"\n ],\n \"model\": \"gemini-embedding-001\",\n \"dimensionality\": 512\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://mavi-backend.memories.ai/serve/api/v2/embeddings/text")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"input\": [\n \"Sample text to embed\",\n \"Another text string\"\n ],\n \"model\": \"gemini-embedding-001\",\n \"dimensionality\": 512\n}"
response = http.request(request)
puts response.read_body{
"code": 200,
"msg": "success",
"data": [
{
"embedding": [
-0.031649195,
0.00069497403,
0.011988669,
"... (continues for `dimensionality` length)"
]
},
{
"embedding": [
0.012345,
-0.067890,
"... (one entry per input string)"
]
}
],
"success": true,
"failed": false
}
Embeddings
Generate Text Embedding
Generate vector embeddings for text using language models
POST
/
embeddings
/
text
Generate Text Embedding
curl --request POST \
--url https://mavi-backend.memories.ai/serve/api/v2/embeddings/text \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"input": [
"Sample text to embed",
"Another text string"
],
"model": "gemini-embedding-001",
"dimensionality": 512
}
'import requests
url = "https://mavi-backend.memories.ai/serve/api/v2/embeddings/text"
payload = {
"input": ["Sample text to embed", "Another text string"],
"model": "gemini-embedding-001",
"dimensionality": 512
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
input: ['Sample text to embed', 'Another text string'],
model: 'gemini-embedding-001',
dimensionality: 512
})
};
fetch('https://mavi-backend.memories.ai/serve/api/v2/embeddings/text', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://mavi-backend.memories.ai/serve/api/v2/embeddings/text",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'input' => [
'Sample text to embed',
'Another text string'
],
'model' => 'gemini-embedding-001',
'dimensionality' => 512
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://mavi-backend.memories.ai/serve/api/v2/embeddings/text"
payload := strings.NewReader("{\n \"input\": [\n \"Sample text to embed\",\n \"Another text string\"\n ],\n \"model\": \"gemini-embedding-001\",\n \"dimensionality\": 512\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://mavi-backend.memories.ai/serve/api/v2/embeddings/text")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"input\": [\n \"Sample text to embed\",\n \"Another text string\"\n ],\n \"model\": \"gemini-embedding-001\",\n \"dimensionality\": 512\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://mavi-backend.memories.ai/serve/api/v2/embeddings/text")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"input\": [\n \"Sample text to embed\",\n \"Another text string\"\n ],\n \"model\": \"gemini-embedding-001\",\n \"dimensionality\": 512\n}"
response = http.request(request)
puts response.read_body{
"code": 200,
"msg": "success",
"data": [
{
"embedding": [
-0.031649195,
0.00069497403,
0.011988669,
"... (continues for `dimensionality` length)"
]
},
{
"embedding": [
0.012345,
-0.067890,
"... (one entry per input string)"
]
}
],
"success": true,
"failed": false
}
Product: Visual Intelligence — Embeddings
Use case: Generate vector embeddings for image, video, or text inputs for semantic search and similarity tasks
Host:
https://mavi-backend.memories.ai/serve/api/v2
Auth: Authorization: sk-mavi-... (no Bearer prefix)Pricing:
- $0.0000002 per token (2e-7/token)
Code Examples
const BASE_URL = "https://mavi-backend.memories.ai/serve/api/v2";
const API_KEY = "sk-mavi-...";
const response = await fetch(`${BASE_URL}/embeddings/text`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': API_KEY
},
body: JSON.stringify({
input: ['Sample text to embed', 'Another text string'],
model: 'gemini-embedding-001',
dimensionality: 512
})
});
const data = await response.json();
console.log(data);
import axios from 'axios';
const BASE_URL = "https://mavi-backend.memories.ai/serve/api/v2";
const API_KEY = "sk-mavi-...";
const response = await axios.post(`${BASE_URL}/embeddings/text`, {
input: ['Sample text to embed', 'Another text string'],
model: 'gemini-embedding-001',
dimensionality: 512
}, {
headers: {
'Authorization': API_KEY
}
});
console.log(response.data);
import requests
BASE_URL = "https://mavi-backend.memories.ai/serve/api/v2"
API_KEY = "sk-mavi-..."
HEADERS = {
"Authorization": f"{API_KEY}"
}
def text_embedding(input_list, model="gemini-embedding-001", dimensionality=512):
url = f"{BASE_URL}/embeddings/text"
data = {
"input": input_list,
"model": model,
"dimensionality": dimensionality
}
response = requests.post(url, headers=HEADERS, json=data)
return response.json()
# Usage example
result = text_embedding(
["Sample text to embed", "Another text string"],
model="gemini-embedding-001",
dimensionality=512
)
print(result)
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
| input | array[string] | Yes | List of text strings to embed (can be a single string or multiple strings) |
| model | string | Yes | Embedding model name |
| dimensionality | integer | No | Output embedding dimension size (e.g., 256, 512, 768). Model-dependent. |
gemini-embedding-001- Google’s Gemini text embedding model
Response
Returns embedding vectors for each input text.The live response shape does not match the previously documented “singular vs plural” split. Live response is always
data: [ {embedding: [...]} ] — an array of objects, each carrying its own embedding (singular) key — regardless of whether you sent one input or many. There is no top-level data.embedding / data.embeddings field. Verified live with gemini-embedding-001.{
"code": 200,
"msg": "success",
"data": [
{
"embedding": [
-0.031649195,
0.00069497403,
0.011988669,
"... (continues for `dimensionality` length)"
]
},
{
"embedding": [
0.012345,
-0.067890,
"... (one entry per input string)"
]
}
],
"success": true,
"failed": false
}
Response Parameters
| Parameter | Type | Description |
|---|---|---|
| code | integer | Response code (200 on success) |
| msg | string | Response message describing the operation result |
| data | array[object] | One entry per input string, in the same order. |
| data[].embedding | array[number] | Vector for that input. Length equals dimensionality (or the model default). |
| success | boolean | Indicates whether the operation was successful |
| failed | boolean | Indicates whether the operation failed |
Notes
- Text embeddings are returned synchronously in the response.
- The response is always an array — index into
data[i].embeddingto get the vector forinput[i]. There is no singular-vs-plural variant. - The
dimensionalityparameter allows you to control the output vector size - Supported dimensionality depends on the model (common values: 256, 512, 768, 1024)
- Lower dimensionality results in faster processing and reduced storage, but may have lower accuracy
- Use text embeddings for:
- Semantic search and similarity matching
- Text classification and clustering
- Question answering and information retrieval
- Recommendation systems
- Duplicate detection
Authorizations
Body
application/json
Response
200 - application/json
Embeddings generated successfully
- Option 1
- Option 2
Response for single input
Response code indicating the result status
Example:
200
Response message describing the operation result
Example:
"success"
Response data object containing the embedding
Show child attributes
Show child attributes
Indicates whether the operation was successful
Example:
true
Indicates whether the operation failed
Example:
false
