Embeddings
curl --request POST \
--url https://api.savegate.ai/v1/embeddings \
--header 'Content-Type: application/json' \
--data '
{
"model": "<string>",
"input": {},
"encoding_format": "<string>"
}
'import requests
url = "https://api.savegate.ai/v1/embeddings"
payload = {
"model": "<string>",
"input": {},
"encoding_format": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({model: '<string>', input: {}, encoding_format: '<string>'})
};
fetch('https://api.savegate.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.savegate.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' => [
],
'encoding_format' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"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.savegate.ai/v1/embeddings"
payload := strings.NewReader("{\n \"model\": \"<string>\",\n \"input\": {},\n \"encoding_format\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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.savegate.ai/v1/embeddings")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"<string>\",\n \"input\": {},\n \"encoding_format\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.savegate.ai/v1/embeddings")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"<string>\",\n \"input\": {},\n \"encoding_format\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"object": "<string>",
"data": [
{
"object": "<string>",
"embedding": [
{}
],
"index": 123
}
],
"model": "<string>",
"usage": {}
}Endpoints
Embeddings
Create vector embeddings for text
POST
/
v1
/
embeddings
Embeddings
curl --request POST \
--url https://api.savegate.ai/v1/embeddings \
--header 'Content-Type: application/json' \
--data '
{
"model": "<string>",
"input": {},
"encoding_format": "<string>"
}
'import requests
url = "https://api.savegate.ai/v1/embeddings"
payload = {
"model": "<string>",
"input": {},
"encoding_format": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({model: '<string>', input: {}, encoding_format: '<string>'})
};
fetch('https://api.savegate.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.savegate.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' => [
],
'encoding_format' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"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.savegate.ai/v1/embeddings"
payload := strings.NewReader("{\n \"model\": \"<string>\",\n \"input\": {},\n \"encoding_format\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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.savegate.ai/v1/embeddings")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"<string>\",\n \"input\": {},\n \"encoding_format\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.savegate.ai/v1/embeddings")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"<string>\",\n \"input\": {},\n \"encoding_format\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"object": "<string>",
"data": [
{
"object": "<string>",
"embedding": [
{}
],
"index": 123
}
],
"model": "<string>",
"usage": {}
}Overview
Create embeddings for text inputs. Useful for semantic search, clustering, and RAG applications.Request
Body Parameters
string
required
Embedding model ID (e.g.,
text-embedding-3-small, text-embedding-ada-002)string or array
required
Text or array of texts to embed
string
default:"float"
Format for embeddings (
float or base64)Response
string
Object type (always
list)array
string
Model used
object
Token usage
Examples
from openai import OpenAI
client = OpenAI(
api_key="sk-savegate-xxxxxxxxxxxxx",
base_url="https://api.savegate.ai/v1"
)
response = client.embeddings.create(
model="text-embedding-3-small",
input="Your text here"
)
embedding = response.data[0].embedding
print(f"Embedding dimension: {len(embedding)}")
import OpenAI from 'openai';
const client = new OpenAI({
apiKey: 'sk-savegate-xxxxxxxxxxxxx',
baseURL: 'https://api.savegate.ai/v1'
});
const response = await client.embeddings.create({
model: 'text-embedding-3-small',
input: 'Your text here'
});
const embedding = response.data[0].embedding;
console.log(`Embedding dimension: ${embedding.length}`);
curl https://api.savegate.ai/v1/embeddings \
-H "Authorization: Bearer sk-savegate-xxxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"model": "text-embedding-3-small",
"input": "Your text here"
}'
Batch Embeddings
# Embed multiple texts at once
texts = [
"First document",
"Second document",
"Third document"
]
response = client.embeddings.create(
model="text-embedding-3-small",
input=texts
)
embeddings = [item.embedding for item in response.data]
print(f"Created {len(embeddings)} embeddings")
Supported Models
| Model | Dimension | Description |
|---|---|---|
text-embedding-3-small | 1536 | Latest, most efficient |
text-embedding-3-large | 3072 | Highest quality |
text-embedding-ada-002 | 1536 | Previous generation |
Use Cases
Semantic Search
Find relevant documents based on meaning
Clustering
Group similar texts together
RAG Applications
Retrieval-augmented generation
Recommendations
Content recommendation systems
⌘I