Skip to content

Create Embeddings ​

POST https://www.kkiai.com/v1/embeddings

Get a vector representation of the given input that machine learning models and algorithms can easily use.

Related guide: Embeddings

Create an embedding vector that represents the input text.

Request Parameters ​

Authorization

Add the Authorization parameter in the Header with the value of Token concatenated after Bearer

Example: Authorization: Bearer ********************

Header Parameters ​

Parameter NameTypeRequiredDescriptionExample
AuthorizationstringOptionalBearer {{YOUR_API_KEY}}

Body Parameters (application/json) ​

Parameter NameTypeRequiredDescription
modelstringRequiredThe ID of the model to use. You can use the List models API to see all available models, or see our Models overview to learn about their descriptions.
inputstringRequiredInput text to get embeddings for, encoded as a string or array of tokens. To get embeddings for multiple inputs in a single request, pass an array of strings or array of token arrays. The length of each input must not exceed 8192 tokens.

Request Example ​

json
{
  "model": "text-embedding-3-large",
  "input": "Artificial intelligence helps developers build smarter applications."
}

cURL Example ​

bash
curl --location --request POST 'https://www.kkiai.com/v1/embeddings' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data-raw '{
  "model": "text-embedding-3-large",
  "input": "Artificial intelligence helps developers build smarter applications."
}'

Response ​

🟢200 Create embeddings

Response Body ​

Parameter NameTypeRequiredDescription
objectstringRequired
dataarray[object]Required
  └ objectstringOptional
  └ embeddingarray[number]Optional
  └ indexintegerOptional
modelstringRequired
usageobjectRequired
  └ prompt_tokensintegerRequired
  └ total_tokensintegerRequired

Response Example ​

json
{
  "object": "list",
  "data": [
    {
      "object": "embedding",
      "embedding": [
        0.0023064255,
        -0.009327292,
        .... (1536 floats total for ada-002)
        -0.0028842222
      ],
      "index": 0
    }
  ],
  "model": "text-embedding-ada-002",
  "usage": {
    "prompt_tokens": 8,
    "total_tokens": 8
  }
}