Skip to main content
POST
/
embeddings
Create embeddings
curl --request POST \
  --url https://api.anyapi.ai/v1/embeddings \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "input": "The food was delicious and the waiter...",
  "model": "text-embedding-ada-002",
  "encoding_format": "float"
}'
{
  "object": "list",
  "data": [
    {
      "object": "embedding",
      "embedding": [
        123
      ],
      "index": 123
    }
  ],
  "model": "<string>",
  "usage": {
    "prompt_tokens": 123,
    "completion_tokens": 123,
    "total_tokens": 123
  }
}

Authorizations

Authorization
string
header
required

Bearer token authentication. Get your API key from the dashboard.

Body

application/json
input
required

Input text to embed

model
string
required

ID of the model to use

Example:

"text-embedding-ada-002"

encoding_format
enum<string>
default:float

The format to return the embeddings in

Available options:
float,
base64
dimensions
integer

The number of dimensions the resulting embeddings should have

Required range: x >= 1
user
string

A unique identifier representing your end-user

Response

Successful response

object
enum<string>
required

The object type, which is always 'list'

Available options:
list
data
object[]
required

Array of embedding objects

model
string
required

The name of the model used to generate the embedding

usage
object
required
I