Skip to main content
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
}
'
{
  "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
}

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.

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)
This endpoint generates vector embeddings for text strings. You can embed single or multiple text inputs in one request, and optionally specify the output dimensionality.
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);

Request Body

FieldTypeRequiredDescription
inputarray[string]YesList of text strings to embed (can be a single string or multiple strings)
modelstringYesEmbedding model name
dimensionalityintegerNoOutput embedding dimension size (e.g., 256, 512, 768). Model-dependent.
Supported Models:
  • 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

ParameterTypeDescription
codeintegerResponse code (200 on success)
msgstringResponse message describing the operation result
dataarray[object]One entry per input string, in the same order.
data[].embeddingarray[number]Vector for that input. Length equals dimensionality (or the model default).
successbooleanIndicates whether the operation was successful
failedbooleanIndicates whether the operation failed

Notes

  • Text embeddings are returned synchronously in the response.
  • The response is always an array — index into data[i].embedding to get the vector for input[i]. There is no singular-vs-plural variant.
  • The dimensionality parameter 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

Authorization
string
header
required

Body

application/json
input
string[]
required

List of text strings to embed

Example:
[
"Sample text to embed",
"Another text string"
]
model
enum<string>
required

Embedding model name

Available options:
gemini-embedding-001
Example:

"gemini-embedding-001"

dimensionality
integer

Output embedding dimension size

Example:

512

Response

200 - application/json

Embeddings generated successfully

Response for single input

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