Create embeddings
POST/embeddings
Creates an embedding vector representing the input text.
Body ParametersJSON
dimensions: optional number
The number of dimensions the resulting output embeddings should have. Only supported in text-embedding-3 and later models.
minimum1
user: optional string
A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. Learn more.
Create embeddings
curl https://api.openai.com/v1/embeddings \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"input": "Hello world",
"model": "text-embedding-3-small",
"encoding_format": "float",
"dimensions": 3
}'
{
"object": "list",
"data": [
{
"object": "embedding",
"embedding": [
0.26726124,
0.53452248,
0.80178373
],
"index": 0
}
],
"model": "text-embedding-3-small",
"usage": {
"prompt_tokens": 2,
"total_tokens": 2
}
}
Returns Examples
{
"object": "list",
"data": [
{
"object": "embedding",
"embedding": [
0.26726124,
0.53452248,
0.80178373
],
"index": 0
}
],
"model": "text-embedding-3-small",
"usage": {
"prompt_tokens": 2,
"total_tokens": 2
}
}