Skip to main content
POST
/
embeddings
cURL
curl -X POST https://api.opper.ai/v2/embeddings \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer ${OPPER_API_KEY}" \
  -d '{
    "input": [
      "What is machine learning?",
      "How do neural networks work?",
      "Explain artificial intelligence"
    ],
    "model": "text-embedding-3-large"
  }'
{
  "model": "<string>",
  "data": [
    {}
  ],
  "usage": {}
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
input
required

The input to embed, can be a single string or a list of strings

Example:

"Hello, world!"

model

The model to use for the embedding, if not provided, EmbeddingModel(hosting_provider='Azure', location='EU', identifier='azure/text-embedding-3-large', name='azure/text-embedding-3-large-1536', dimensions=1536, max_tokens=8191, credentials='azure-se', is_default=True, is_public=True, extra={'api_base': 'https://opperopenaiservice.openai.azure.com', 'api_version': '2023-05-15', 'dimensions': 1536}) will be used

Example:
{
"extra_headers": {},
"name": "text-embedding-3-large",
"options": { "dimensions": 256 }
}

Response

Successful Response

model
string
required

The model that was used to create the embedding

Example:

"text-embedding-3-large"

data
Data · object[]
required

The embedding data

Example:
{ "embedding": [0.1, 0.2, 0.3], "index": 0 }
usage
Usage · object
required

The usage information

Example:
{ "prompt_tokens": 100, "total_tokens": 100 }