On this page

Embeddings

Base path: /v1

POST /embeddings

Creates embeddings for text, token IDs, or chat messages. Send exactly one of input or messages. Up to 20 inputs or conversations are allowed per request. Images in messages must be base64 data URIs, with a total image payload of at most 20MB.

ParameterTypeRequiredDescription
Core Input
modelstringrequiredEmbedding model identifier. Use GET /v1/embedding-models to list models available to your account.
inputstring | list[string] | list[int] | list[list[int]] | list[chat messages]required (or messages)Text, token IDs, a list of texts, or chat messages to embed. Exactly one of input or messages must be provided. Lists are capped at 20 items per request.
messageslist[message] | list[list[message]]required (or input)One chat conversation or a batch of conversations to embed. Exactly one of input or messages must be provided. Batches are capped at 20 conversations. Use content parts for multimodal input; image URLs must be base64 data URIs (data:image/...) and the total image payload is limited to 20MB.
Encoding
encoding_format"float" | "base64"optionalEmbedding encoding. "float" returns a JSON number array; "base64" returns base64-encoded binary and is more compact. Default: "float".
dimensionsintegeroptionalRequested embedding size. Must be a positive integer when set. Model support and truncation behavior are model-dependent.
embed_dtype"float32" | "float16" | "bfloat16" | "fp8_e4m3" | "fp8_e5m2"optionalNumeric dtype used when encoding_format is "base64". Default: "float32".
endianness"native" | "big" | "little"optionalByte order used when encoding_format is "base64". Default: "native".
use_activationboolean | nulloptionalWhether to apply the pooler's activation to the output. null uses the model's default, which is usually true.
Truncation & Tokenization
truncate_prompt_tokensintegeroptionalTruncate each input to this many tokens. Use -1 to keep all tokens, or a positive integer to keep only that many.
truncation_side"left" | "right"optionalSide to keep when truncating. "right" keeps the first N tokens; "left" keeps the last N tokens.
padding"max_length" | "do_not_pad"optionalTokenizer padding mode. "max_length" is required by some fixed-length embedding models such as SigLIP to produce comparable embeddings.
add_special_tokensbooleanoptionalWhether to add model special tokens (for example BOS) to the input. Defaults to true for text input and false for chat messages.
1curl -X POST https://api.arliai.com/v1/embeddings \
2-H "Content-Type: application/json" \
3-H "Authorization: Bearer your_api_key" \
4-d '{
5  "model": "EMBEDDING_MODEL_NAME",
6  "input": [
7    "The food was delicious.",
8    "The service was slow."
9  ],
10  "encoding_format": "float"
11}'

Response Example

1{
2  "id": "embd-2c0a5f6e-4f1b-4a5e-9f2f-3c7f9d1a6b8e",
3  "object": "list",
4  "created": 1760000000,
5  "model": "EMBEDDING_MODEL_NAME",
6  "data": [
7    {
8      "index": 0,
9      "object": "embedding",
10      "embedding": [0.0123, -0.0456, 0.0789]
11    },
12    {
13      "index": 1,
14      "object": "embedding",
15      "embedding": [-0.0321, 0.0678, 0.0912]
16    }
17  ],
18  "usage": {
19    "prompt_tokens": 12,
20    "total_tokens": 12
21  }
22}

The embedding array above is shortened for display. For compact responses, use encoding_format: "base64". Binary responses use embed_dtype and endianness to describe how to decode them.

1curl -X POST https://api.arliai.com/v1/embeddings \
2-H "Content-Type: application/json" \
3-H "Authorization: Bearer your_api_key" \
4-d '{
5  "model": "EMBEDDING_MODEL_NAME",
6  "input": ["A compact base64 embedding"],
7  "encoding_format": "base64",
8  "embed_dtype": "float32",
9  "endianness": "native"
10}'

POST /embeddings (Multimodal)

Use messages with content parts to embed images and text together. Each image_url.url must be a base64 data URI such as data:image/jpeg;base64,...; remote image URLs are rejected.

1curl -X POST https://api.arliai.com/v1/embeddings \
2-H "Content-Type: application/json" \
3-H "Authorization: Bearer your_api_key" \
4-d '{
5  "model": "EMBEDDING_MODEL_NAME",
6  "messages": [
7    {
8      "role": "user",
9      "content": [
10        {"type": "text", "text": "A red bicycle leaning against a wall."},
11        {
12          "type": "image_url",
13          "image_url": {
14            "url": "data:image/jpeg;base64,your_base64_encoded_image"
15          }
16        }
17      ]
18    }
19  ],
20  "encoding_format": "float"
21}'

POST /embeddings (Batch Conversations)

Pass an array of conversations to messages to embed up to 20 conversations in one request. Each conversation must be a non-empty array of messages.

1curl -X POST https://api.arliai.com/v1/embeddings \
2-H "Content-Type: application/json" \
3-H "Authorization: Bearer your_api_key" \
4-d '{
5  "model": "EMBEDDING_MODEL_NAME",
6  "messages": [
7    [
8      {"role": "user", "content": "First conversation to embed."}
9    ],
10    [
11      {"role": "user", "content": "Second conversation to embed."}
12    ]
13  ]
14}'