Create embeddings
POST
https://api.openai.com/v1/embeddings
Request Request Example
Shell
JavaScript
Java
Swift
curl --location --request POST 'https://api.openai.com/v1/embeddings' \
--header 'Authorization: Bearer $OPENAI_API_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
"input": "The food was delicious and the waiter...",
"model": "text-embedding-ada-002",
"encoding_format": "float"
}'
Response Response Example
{
"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
}
}
Request
Header Params
Authorization
stringΒ
required
Example:
Bearer $OPENAI_API_KEY
Content-Type
stringΒ
required
Example:
application/json
Body Params application/json
Responses
Modified atΒ 2024-12-11 08:50:33