Skip to main content
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'
{
  "code": 200,
  "msg": "success",
  "data": {
    "embedding": [
      0.0234375,
      -0.015625,
      0.0078125,
      0.0390625,
      -0.0234375,
      "... (continues for vector length)"
    ]
  },
  "success": true,
  "failed": false
}

Documentation Index

Fetch the complete documentation index at: https://api-tools.memories.ai/llms.txt

Use this file to discover all available pages before exploring further.

This endpoint generates vector embeddings for images. You can either upload an image file directly or reference an existing asset by its ID.
Pricing:
  • $0.0001 per image

Code Examples

const BASE_URL = "https://mavi-backend.memories.ai/serve/api/v2";
const API_KEY = "sk-mai-this_a_test_string_please_use_your_generated_key_during_testing";

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);

Request Parameters

This endpoint supports two methods of providing images: Method 1: File Upload (multipart/form-data)
FieldTypeRequiredDescription
filefileYesImage file to upload (JPEG, PNG, GIF, WebP, etc.)
modelstringYesEmbedding model name
Method 2: Asset ID (application/json)
FieldTypeRequiredDescription
asset_idstringYesExisting image asset ID from a previous upload
modelstringYesEmbedding model name
Supported Models:
  • multimodalembedding@001 - Google’s multimodal embedding model
  • mobileclip - 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

ParameterTypeDescription
codestringResponse code indicating the result status (200 indicates success)
msgstringResponse message describing the operation result
dataobjectResponse data object containing the embedding
data.embeddingarray[number]Vector embedding array (dimensionality depends on the model)
successbooleanIndicates whether the operation was successful
failedbooleanIndicates 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 /upload endpoint
  • Embeddings can be used for image similarity search, classification, and clustering

Authorizations

Authorization
string
header
required

Body

model
enum<string>
required

Embedding model name

Available options:
multimodalembedding@001,
mobileclip
Example:

"multimodalembedding@001"

file
file

Image file to upload

Response

200 - application/json

Embedding generated successfully

code
string

Response code indicating the result status

Example:

200

msg
string

Response message describing the operation result

Example:

"success"

data
object

Response data object containing the embedding

success
boolean

Indicates whether the operation was successful

Example:

true

failed
boolean

Indicates whether the operation failed

Example:

false