Create embeddings
POST
/embeddings
const url = 'https://example.com/embeddings';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"input":"hello world","model":"text-embedding-3-small"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://example.com/embeddings \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "input": "hello world", "model": "text-embedding-3-small" }'OpenAI-compatible embeddings. input is a string or array of strings. Models: text-embedding-3-small (1536-dim) / -large (3072-dim). Charged per input token.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”Media typeapplication/json
EmbeddingsRequest
object
model
required
Model
Text-embedding-3-small | text-embedding-3-large (or text-embedding-ada-002).
string
input
required
Any of:
string
Array<string>
Example
{ "input": "hello world", "model": "text-embedding-3-small"}Responses
Section titled “Responses”Successful Response
Media typeapplication/json
Examplegenerated
exampleValidation Error
Media typeapplication/json
HTTPValidationError
object
detail
Detail
Array<object>
ValidationErrorobject
loc
required
Location
Array
msg
required
Message
string
type
required
Error Type
string
input
Input
ctx
Context
object
Examplegenerated
{ "detail": [ { "loc": [ "example" ], "msg": "example", "type": "example", "input": "example", "ctx": {} } ]}