API reference · Embeddings

Embeddings

POST/v1/embeddings

Embed text through your own OpenAI or Google key, in the OpenAI embeddings shape.

Open Memtro

Embeddings in the OpenAI shape, through your own OpenAI or Google key (or an OpenAI-compatible endpoint you configured), never the platform's. Memory itself needs no key of yours: this endpoint is for your own use of embeddings.

Example

Against https://platform.memtro.com, with your key in MEMTRO_API_KEY.

curl https://platform.memtro.com/v1/embeddings \
  -H "Authorization: Bearer $MEMTRO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "openai/text-embedding-3-small", "input": ["billing migration", "Q3 launch"]}'

Vectors shortened here.

{
  "object": "list",
  "data": [
    { "object": "embedding", "index": 0, "embedding": [0.0123, -0.0481, …] },
    { "object": "embedding", "index": 1, "embedding": [-0.0067, 0.0215, …] }
  ],
  "model": "openai/text-embedding-3-small",
  "usage": { "prompt_tokens": 6, "total_tokens": 6 }
}

Authentication

An API key, as Authorization: Bearer or x-api-key.

  • Every reply, errors included, carries x-request-id and request-id headers with the same id, starting req-. Quote it to support.
  • It sends no CORS headers, so a page on another origin cannot call it; call it from a server.

Request body

JSON, with Content-Type: application/json.

modelstringOptional

An embedding model id. memtro and brain mean the default.

Default:

The server's embedding model, then openai/text-embedding-3-small, then google/gemini-embedding-001, whichever you hold a key for

inputstring or array of stringsRequired

The text to embed, or several.

encoding_formatstringOptional

Accepted, but the reply is always arrays of floats.

One of float or base64.

Response

200application/json

One vector per input, in order.

object"list"Optional

Always list.

dataarray of objectsOptional

{"object": "embedding", "index", "embedding": [numbers]} per input. OpenAI and Google models are asked for vectors of the server's configured dimension.

modelstringOptional

<provider>/<model> that made them.

usageobjectOptional

prompt_tokens, total_tokens.

Errors

In the OpenAI envelope, {"error": {"message", "type", "param", "code"}}. What each code means and what to do about it is in the error catalogue.

StatusCodeWhen
400none

The body is not { input: string | string[] }.

400provider_not_configured

No embedding-capable key: add an OpenAI or Google key.

400invalid_provider_base_url

An OpenAI-compatible endpoint's base URL cannot be used: not a URL, not https://, a user name or password in it, or a port not accepted.

400provider_base_url_not_allowed

An OpenAI-compatible endpoint's host is not approved for the organisation, is private or internal, does not resolve, or redirected, whether refused before the request or during it.

401invalid_api_key

The key is missing, malformed, revoked or expired.

402subscription_inactive

The organisation has no active subscription.

provider'supstream_error

The provider returned an error.

Notes

No CORS headers: call it from a server, not from a page on another origin.

Where agents remember your company

Sign in, add a provider key, create an API key and point your tools at Memtro. It takes about five minutes.

7-day free trial · card on file, nothing charged until it ends · cancel any time