Skip to main content
POST
/
dedicated
/
v1
/
embeddings
Embeddings
curl --request POST \
  --url https://api.friendli.ai/dedicated/v1/embeddings \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "encoding_format": "float",
  "input": "The food was delicious and the waiter...",
  "model": "(endpoint-id)"
}'
{
  "id": "embd-26a1e10db1311bc2adb488d2d205288b",
  "model": "(endpoint-id)",
  "object": "list",
  "data": [
    {
      "index": 0,
      "object": "embedding",
      "embedding": [
        0.0023064255,
        -0.009327292,
        -0.0028842222
      ]
    }
  ],
  "usage": {
    "prompt_tokens": 26,
    "completion_tokens": 0,
    "total_tokens": 26
  },
  "created": 1735722153
}
Creates an embedding vector representing the input text. To request successfully, it is mandatory to enter a Friendli Token (e.g. flp_XXX) value in the Bearer Token field. Refer to the authentication section on our introduction page to learn how to acquire this variable and visit here to generate your token.

Authorizations

Authorization
string
header
required

When using Friendli Suite API for inference requests, you need to provide a Friendli Token for authentication and authorization purposes.

For more detailed information, please refer here.

Headers

X-Friendli-Team
string | null

ID of team to run requests as (optional parameter).

Body

application/json
model
string
required

ID of target endpoint. If you want to send request to specific adapter, use the format "YOUR_ENDPOINT_ID:YOUR_ADAPTER_ROUTE". Otherwise, you can just use "YOUR_ENDPOINT_ID" alone.

Examples:

"(endpoint-id)"

input
required

Input text to embed, encoded as a string or array of tokens. To embed multiple inputs in a single request, pass an array of strings or array of token arrays.

Examples:

"The food was delicious and the waiter..."

encoding_format
enum<string> | null
default:float

The format to return the embeddings in. Can be either float or base64.

Available options:
float,
base64

Response

Successfully generated embeddings.

id
string
required

A unique ID of the embeddings.

object
string
required

The object type, which is always set to list.

Allowed value: "list"
data
EmbeddingObject · object[]
required

A list of embedding objects.

usage
object
required
created
integer
required

The Unix timestamp (in seconds) for when the embeddings were created.

model
string | null

The model to generate the embeddings. For dedicated endpoints, it returns the endpoint id.