Embeddings
curl --request POST \
--url https://api.redpill.ai/v1/embeddings \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "<string>",
"input": [
"<string>"
],
"encoding_format": "<string>",
"dimensions": 123
}
'import requests
url = "https://api.redpill.ai/v1/embeddings"
payload = {
"model": "<string>",
"input": ["<string>"],
"encoding_format": "<string>",
"dimensions": 123
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: '<string>',
input: ['<string>'],
encoding_format: '<string>',
dimensions: 123
})
};
fetch('https://api.redpill.ai/v1/embeddings', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.redpill.ai/v1/embeddings",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => '<string>',
'input' => [
'<string>'
],
'encoding_format' => '<string>',
'dimensions' => 123
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.redpill.ai/v1/embeddings"
payload := strings.NewReader("{\n \"model\": \"<string>\",\n \"input\": [\n \"<string>\"\n ],\n \"encoding_format\": \"<string>\",\n \"dimensions\": 123\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.redpill.ai/v1/embeddings")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"<string>\",\n \"input\": [\n \"<string>\"\n ],\n \"encoding_format\": \"<string>\",\n \"dimensions\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.redpill.ai/v1/embeddings")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"<string>\",\n \"input\": [\n \"<string>\"\n ],\n \"encoding_format\": \"<string>\",\n \"dimensions\": 123\n}"
response = http.request(request)
puts response.read_bodyEndpoints
Embeddings
Create text embeddings.
POST
/
embeddings
Embeddings
curl --request POST \
--url https://api.redpill.ai/v1/embeddings \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "<string>",
"input": [
"<string>"
],
"encoding_format": "<string>",
"dimensions": 123
}
'import requests
url = "https://api.redpill.ai/v1/embeddings"
payload = {
"model": "<string>",
"input": ["<string>"],
"encoding_format": "<string>",
"dimensions": 123
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: '<string>',
input: ['<string>'],
encoding_format: '<string>',
dimensions: 123
})
};
fetch('https://api.redpill.ai/v1/embeddings', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.redpill.ai/v1/embeddings",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => '<string>',
'input' => [
'<string>'
],
'encoding_format' => '<string>',
'dimensions' => 123
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.redpill.ai/v1/embeddings"
payload := strings.NewReader("{\n \"model\": \"<string>\",\n \"input\": [\n \"<string>\"\n ],\n \"encoding_format\": \"<string>\",\n \"dimensions\": 123\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.redpill.ai/v1/embeddings")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"<string>\",\n \"input\": [\n \"<string>\"\n ],\n \"encoding_format\": \"<string>\",\n \"dimensions\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.redpill.ai/v1/embeddings")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"<string>\",\n \"input\": [\n \"<string>\"\n ],\n \"encoding_format\": \"<string>\",\n \"dimensions\": 123\n}"
response = http.request(request)
puts response.read_bodyGenerate vector embeddings from text for semantic search, similarity, clustering, and retrieval.
Requests are served through the attested TEE gateway, which does not retain request bodies. Use
Embedding requests accept the same
Keep one model and one dimension count per index. Vectors from different models are not comparable.
is_tee from the embedding catalog to find confidential-capable models and verify the receipt for
the actual request.
POST https://api.redpill.ai/v1/embeddings
Request body
string
required
Model id returned by
GET /v1/embeddings/models.string | string[]
required
Text to embed. Pass a single string or an array of strings for batch embedding.
string
float (default) or base64.integer
Optional output dimension count. Supported by
openai/text-embedding-3-small and
openai/text-embedding-3-large, which can return fewer dimensions than their default.Example
curl https://api.redpill.ai/v1/embeddings \
-H "Authorization: Bearer $REDPILL_AI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "qwen/qwen3-embedding-8b",
"input": "Confidential AI you can verify."
}'
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["REDPILL_AI_API_KEY"],
base_url="https://api.redpill.ai/v1",
)
resp = client.embeddings.create(
model="qwen/qwen3-embedding-8b",
input="Confidential AI you can verify.",
)
print(len(resp.data[0].embedding))
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.redpill.ai/v1",
apiKey: process.env.REDPILL_AI_API_KEY,
});
const resp = await client.embeddings.create({
model: "qwen/qwen3-embedding-8b",
input: "Confidential AI you can verify.",
});
console.log(resp.data[0].embedding.length);
Batch input
Pass an array to embed several strings in one request. Results are returned in input order, each with itsindex.
curl https://api.redpill.ai/v1/embeddings \
-H "Authorization: Bearer $REDPILL_AI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "qwen/qwen3-embedding-8b",
"input": ["first document", "second document"]
}'
Response
{
"object": "list",
"data": [
{ "object": "embedding", "index": 0, "embedding": [0.0167, -0.0557, "…"] }
],
"model": "openai/text-embedding-3-small",
"usage": { "prompt_tokens": 8, "total_tokens": 8 }
}
Model catalog
The publicGET /v1/embeddings/models catalog is authoritative. It accepts the same zdr filter as
the chat model catalog:
curl -s "https://api.redpill.ai/v1/embeddings/models?zdr=true" \
| jq -r '.data[].id'
provider routing block as chat completions, including
zdr, aci_verified, and aci_session_ids.
See Zero data retention.
Custom dimensions
openai/text-embedding-3-small and openai/text-embedding-3-large accept a dimensions parameter to
return shorter vectors, which reduces storage and speeds up similarity search at some cost to quality.
curl https://api.redpill.ai/v1/embeddings \
-H "Authorization: Bearer $REDPILL_AI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "openai/text-embedding-3-large",
"input": "shorter vector",
"dimensions": 1024
}'
Related
Models
Chat and confidential models.
Trust boundary
What the gateway protects.
Was this page helpful?