Generate Image Embedding
curl --request POST \
--url https://mavi-backend.memories.ai/serve/api/v2/embeddings/image \
--header 'Authorization: <api-key>' \
--header 'Content-Type: multipart/form-data' \
--form model=multimodalembedding@001 \
--form file='@example-file'import requests
url = "https://mavi-backend.memories.ai/serve/api/v2/embeddings/image"
files = { "file": ("example-file", open("example-file", "rb")) }
payload = { "model": "multimodalembedding@001" }
headers = {"Authorization": "<api-key>"}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('model', 'multimodalembedding@001');
form.append('file', '<string>');
const options = {method: 'POST', headers: {Authorization: '<api-key>'}};
options.body = form;
fetch('https://mavi-backend.memories.ai/serve/api/v2/embeddings/image', 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/image",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"model\"\r\n\r\nmultimodalembedding@001\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: multipart/form-data"
],
]);
$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/image"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"model\"\r\n\r\nmultimodalembedding@001\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
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/image")
.header("Authorization", "<api-key>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"model\"\r\n\r\nmultimodalembedding@001\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://mavi-backend.memories.ai/serve/api/v2/embeddings/image")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"model\"\r\n\r\nmultimodalembedding@001\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"code": 200,
"msg": "success",
"data": {
"embedding": [
0.0234375,
-0.015625,
0.0078125,
0.0390625,
-0.0234375,
"... (continues for vector length)"
]
},
"success": true,
"failed": false
}
Embeddings
Generate Image Embedding
Generate vector embeddings for images using multimodal models
POST
/
embeddings
/
image
Generate Image Embedding
curl --request POST \
--url https://mavi-backend.memories.ai/serve/api/v2/embeddings/image \
--header 'Authorization: <api-key>' \
--header 'Content-Type: multipart/form-data' \
--form model=multimodalembedding@001 \
--form file='@example-file'import requests
url = "https://mavi-backend.memories.ai/serve/api/v2/embeddings/image"
files = { "file": ("example-file", open("example-file", "rb")) }
payload = { "model": "multimodalembedding@001" }
headers = {"Authorization": "<api-key>"}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('model', 'multimodalembedding@001');
form.append('file', '<string>');
const options = {method: 'POST', headers: {Authorization: '<api-key>'}};
options.body = form;
fetch('https://mavi-backend.memories.ai/serve/api/v2/embeddings/image', 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/image",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"model\"\r\n\r\nmultimodalembedding@001\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: multipart/form-data"
],
]);
$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/image"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"model\"\r\n\r\nmultimodalembedding@001\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
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/image")
.header("Authorization", "<api-key>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"model\"\r\n\r\nmultimodalembedding@001\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://mavi-backend.memories.ai/serve/api/v2/embeddings/image")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"model\"\r\n\r\nmultimodalembedding@001\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"code": 200,
"msg": "success",
"data": {
"embedding": [
0.0234375,
-0.015625,
0.0078125,
0.0390625,
-0.0234375,
"... (continues for vector length)"
]
},
"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.0001 per image
Code Examples
const BASE_URL = "https://mavi-backend.memories.ai/serve/api/v2";
const API_KEY = "sk-mavi-...";
const formData = new FormData();
formData.append('file', imageFile);
formData.append('model', 'multimodalembedding@001');
const response = await fetch(`${BASE_URL}/embeddings/image`, {
method: 'POST',
headers: {
'Authorization': API_KEY
},
body: formData
});
const data = await response.json();
console.log(data);
const BASE_URL = "https://mavi-backend.memories.ai/serve/api/v2";
const API_KEY = "sk-mavi-...";
const response = await fetch(`${BASE_URL}/embeddings/image`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': API_KEY
},
body: JSON.stringify({
asset_id: 'imc_657766047105290240_15',
model: 'multimodalembedding@001'
})
});
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 formData = new FormData();
formData.append('file', imageFile);
formData.append('model', 'multimodalembedding@001');
const response = await axios.post(`${BASE_URL}/embeddings/image`, formData, {
headers: {
'Authorization': API_KEY
}
});
console.log(response.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/image`, {
asset_id: 'imc_657766047105290240_15',
model: 'multimodalembedding@001'
}, {
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 image_embedding_from_file(file_path, model="multimodalembedding@001"):
url = f"{BASE_URL}/embeddings/image"
data = {"model": model}
files = {"file": open(file_path, "rb")}
response = requests.post(url, headers=HEADERS, data=data, files=files)
return response.json()
# Usage example
result = image_embedding_from_file("path/to/image.png", model="multimodalembedding@001")
print(result)
import requests
BASE_URL = "https://mavi-backend.memories.ai/serve/api/v2"
API_KEY = "sk-mavi-..."
HEADERS = {
"Authorization": f"{API_KEY}"
}
def image_embedding_from_asset(asset_id, model="multimodalembedding@001"):
url = f"{BASE_URL}/embeddings/image"
data = {"asset_id": asset_id, "model": model}
response = requests.post(url, headers=HEADERS, json=data)
return response.json()
# Usage example
result = image_embedding_from_asset("imc_657766047105290240_15", model="multimodalembedding@001")
print(result)
Request Parameters
This endpoint supports two methods of providing images: Method 1: File Upload (multipart/form-data)| Field | Type | Required | Description |
|---|---|---|---|
| file | file | Yes | Image file to upload (JPEG, PNG, GIF, WebP, etc.) |
| model | string | Yes | Embedding model name |
| Field | Type | Required | Description |
|---|---|---|---|
| asset_id | string | Yes | Existing image asset ID from a previous upload |
| model | string | Yes | Embedding model name |
multimodalembedding@001- Google’s multimodal embedding modelmobileclip- Efficient mobile-optimized CLIP model
Response
Returns the embedding vector synchronously.{
"code": 200,
"msg": "success",
"data": {
"embedding": [
0.0234375,
-0.015625,
0.0078125,
0.0390625,
-0.0234375,
"... (continues for vector length)"
]
},
"success": true,
"failed": false
}
Response Parameters
| Parameter | Type | Description |
|---|---|---|
| code | string | Response code indicating the result status (200 indicates success) |
| msg | string | Response message describing the operation result |
| data | object | Response data object containing the embedding |
| data.embedding | array[number] | Vector embedding array (dimensionality depends on the model) |
| success | boolean | Indicates whether the operation was successful |
| failed | boolean | Indicates whether the operation failed |
Notes
- Image embeddings are returned synchronously in the response
- Embedding dimensions vary by model (typically 512-1024 dimensions)
- Supported image formats: JPEG, PNG, GIF, WebP, BMP, TIFF
- Maximum file size may vary by deployment
- Use the file upload method for one-time embedding generation
- Use the asset ID method when you’ve already uploaded the image via the
/uploadendpoint - Embeddings can be used for image similarity search, classification, and clustering
Authorizations
Body
multipart/form-dataapplication/json
Response
200 - application/json
Embedding generated successfully
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
