Skip to main content
POST
/
v1
/
code
/
embed
cURL
curl --request POST \
  --url https://embeddings.endpoint.relace.run/v1/code/embed \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "model": "relace-embed-v1",
  "input": [
    "input 1",
    "input 2"
  ]
}'
{
  "results": [
    [
      {
        "index": 0,
        "embedding": [
          0.123,
          0.456,
          0.789
        ]
      },
      {
        "index": 1,
        "embedding": [
          0.234,
          0.567,
          0.89
        ]
      }
    ]
  ],
  "usage": {
    "total_tokens": 8
  }
}

Authorizations

Authorization
string
header
required

Relace API key Authorization header using the Bearer scheme.

Body

application/json

Codebase context for embedding

model
string

The model to use for embedding

input
string[]

Array of strings to embed

output_dtype
enum<string>
default:float

Data type of the output embedding vectors. The binary quantization results in more compact embeddings with only a small loss in retrieval performance. See HuggingFace blog post for details.

Available options:
float,
binary

Response

Codebase embedded successfully

results
object[]

Array of embeddings of the input strings

usage
object

Token usage information for the request

I