Skip to content

Creates an embedding vector representing the input text.

POST
/embeddings

Authorizations

Request Body required

object
input
required
One of:

The string that will be turned into an embedding.

string
""
This is a test.
model
required
Any of:
string
encoding_format

The format to return the embeddings in. Can be either float or base64.

string
default: float
Allowed values: float base64
float
dimensions

The number of dimensions the resulting output embeddings should have. Only supported in text-embedding-3 and later models.

integer
>= 1
user

A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. Learn more.

string
user-1234

Responses

200

OK

object
data
required

The list of embeddings generated by the model.

Array<object>

Represents an embedding vector returned by embedding endpoint.

object
index
required

The index of the embedding in the list of embeddings.

integer
embedding
required

The embedding vector, which is a list of floats. The length of vector depends on the model as listed in the embedding guide.

Array<number>
object
required

The object type, which is always “embedding”.

string
Allowed values: embedding
model
required

The name of the model used to generate the embedding.

string
object
required

The object type, which is always “list”.

string
Allowed values: list
usage
required

The usage information for the request.

object
prompt_tokens
required

The number of tokens used by the prompt.

integer
total_tokens
required

The total number of tokens used by the request.

integer