Body Required
input string | array[string] | array[integer] | array[array] Required
One of: The string that will be turned into an embedding.
Default value is empty.
The array of strings that will be turned into an embedding.
At least
1
but not more than2048
elements. Default value is empty.The array of integers that will be turned into an embedding.
At least
1
but not more than2048
elements.The array of arrays containing integers that will be turned into an embedding.
At least
1
but not more than2048
elements.At least
1
element.model string Required
Any of: ID of the model to use. You can use the List models API to see all of your available models, or see our Model overview for descriptions of them.
ID of the model to use. You can use the List models API to see all of your available models, or see our Model overview for descriptions of them.
Values are
text-embedding-ada-002
,text-embedding-3-small
, ortext-embedding-3-large
.-
encoding_format string
The format to return the embeddings in. Can be either
float
orbase64
.Values are
float
orbase64
. Default value isfloat
. -
dimensions integer
The number of dimensions the resulting output embeddings should have. Only supported in
text-embedding-3
and later models.Minimum value is
1
. -
user string
A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. Learn more.
curl \
-X POST https://api.openai.com/v1/embeddings \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{"input":"This is a test.","model":"text-embedding-3-small","encoding_format":"float","dimensions":42,"user":"user-1234"}'
{
"input": "This is a test.",
"model": "text-embedding-3-small",
"encoding_format": "float",
"dimensions": 42,
"user": "user-1234"
}
{
"data": [
{
"index": 42,
"embedding": [
42.0
],
"object": "embedding"
}
],
"model": "string",
"object": "list",
"usage": {
"prompt_tokens": 42,
"total_tokens": 42
}
}