Embeddings

Create an embedding

post

This endpoint creates an embedding using the specified model.

Authorizations
Body

A request object for generating embeddings. This object contains suggested parameters to generate an embedding from the specified model; however, you may include other parameters as required. Note that not all providers support the same set of parameters. Adding unsupported or unnecessary parameters can cause requests to fail or limit the providers able to process them.

modelstringOptional

The model to use for the embedding.

Example: mistral-embed
inputone ofOptional
stringOptional

A single input to embed.

Example: Please embed this sentence.
or
string[]Optional

A list of inputs to embed.

Example: ["First sentence to embed.","Second sentence to embed."]
preferencestring · enumOptional

The provider preference for handling the request.

Default: balancedPossible values:
allowed_providersstring[] | nullableOptional

The providers that are allowed to be used for the embedding.

Example: ["mistral","scaleway"]
eu_nativeboolean | nullableOptional

Whether to consider only providers based and regulated withing the EU. Even when false, all our endpoints are GDPR compliant.

Default: falseExample: false
allow_quantizationboolean | nullableOptional

Whether to allow quantized endpoints.

Default: trueExample: true
encoding_formatstring · enumOptional

The encoding to use for the output.

Default: floatExample: floatPossible values:
Responses
200

An embedding.

application/json
post
/embeddings
POST /v1/embeddings HTTP/1.1
Host: api.cortecs.ai
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 200

{
  "model": "mistral-embed",
  "input": "Please embed this sentence.",
  "preference": "balanced",
  "allowed_providers": [
    "mistral",
    "scaleway"
  ],
  "eu_native": false,
  "allow_quantization": true,
  "encoding_format": "float"
}
{
  "id": "cmpl_1234567890",
  "object": "list",
  "created": 1715155200,
  "provider": "mistral",
  "model": "mistral-embed",
  "data": [
    {
      "index": 0,
      "object": "embedding",
      "embedding": [
        0.1,
        0.2,
        0.3
      ]
    }
  ],
  "usage": {
    "prompt_tokens": 10,
    "completion_tokens": 0,
    "total_tokens": 10
  }
}

Last updated