Skip to main content
POST
/
v1
/
embeddings
Create an embedding
curl --request POST \
  --url https://tokens.flex.ai/v1/embeddings \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "model": "bge-m3",
  "input": "hello world",
  "encoding_format": "float"
}
'
{
  "object": "list",
  "data": [
    {
      "object": "embedding",
      "index": 123,
      "embedding": [
        123
      ]
    }
  ],
  "model": "<string>",
  "usage": {
    "prompt_tokens": 123,
    "total_tokens": 123
  }
}

Authorizations

Authorization
string
header
required

Virtual API key. Create one from the FlexAI dashboard. Pass as Authorization: Bearer sk-xxxx.

Body

application/json
model
string
required

Embedding model id. See the model catalog.

Example:

"bge-m3"

input
required

Text (or list of texts) to embed.

Example:

"hello world"

encoding_format
enum<string>
default:float

Encoding of the returned embedding values. Optional; defaults to "float" (matching OpenAI). Use "base64" for the compact wire format. Pass a string or omit the field — do not send an explicit null.

Available options:
float,
base64

Response

Successful response.

object
enum<string>
required
Available options:
list
data
object[]
required
model
string
required
usage
object
required