Generate embeddings
curl --request POST \
--url https://api.gately.ai/v1/embeddings \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "jina-embeddings-v3",
"input": [
"Generate vector representations of this text"
]
}
'import requests
url = "https://api.gately.ai/v1/embeddings"
payload = {
"model": "jina-embeddings-v3",
"input": ["Generate vector representations of this text"]
}
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: 'jina-embeddings-v3',
input: ['Generate vector representations of this text']
})
};
fetch('https://api.gately.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.gately.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' => 'jina-embeddings-v3',
'input' => [
'Generate vector representations of this text'
]
]),
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.gately.ai/v1/embeddings"
payload := strings.NewReader("{\n \"model\": \"jina-embeddings-v3\",\n \"input\": [\n \"Generate vector representations of this text\"\n ]\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.gately.ai/v1/embeddings")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"jina-embeddings-v3\",\n \"input\": [\n \"Generate vector representations of this text\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gately.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\": \"jina-embeddings-v3\",\n \"input\": [\n \"Generate vector representations of this text\"\n ]\n}"
response = http.request(request)
puts response.read_body{}AI Models API
Embeddings API
Generate vector embeddings from text for semantic search and similarity operations
POST
/
v1
/
embeddings
Generate embeddings
curl --request POST \
--url https://api.gately.ai/v1/embeddings \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "jina-embeddings-v3",
"input": [
"Generate vector representations of this text"
]
}
'import requests
url = "https://api.gately.ai/v1/embeddings"
payload = {
"model": "jina-embeddings-v3",
"input": ["Generate vector representations of this text"]
}
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: 'jina-embeddings-v3',
input: ['Generate vector representations of this text']
})
};
fetch('https://api.gately.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.gately.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' => 'jina-embeddings-v3',
'input' => [
'Generate vector representations of this text'
]
]),
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.gately.ai/v1/embeddings"
payload := strings.NewReader("{\n \"model\": \"jina-embeddings-v3\",\n \"input\": [\n \"Generate vector representations of this text\"\n ]\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.gately.ai/v1/embeddings")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"jina-embeddings-v3\",\n \"input\": [\n \"Generate vector representations of this text\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gately.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\": \"jina-embeddings-v3\",\n \"input\": [\n \"Generate vector representations of this text\"\n ]\n}"
response = http.request(request)
puts response.read_body{}Embeddings API
The Embeddings API allows you to convert text into numerical vector representations that capture semantic meaning. These embeddings enable powerful operations like:- Semantic text search
- Text clustering and classification
- Content recommendation
- Similarity comparisons
Available Models
Gately AI offers several embedding models with different dimensions and performance characteristics:| Model | Dimensions | Context Window | Best For |
|---|---|---|---|
| jina-embeddings-v3 | 1024 | 8192 tokens | General purpose, multilingual |
| text-embedding-3-large | 3072 | 8191 tokens | High accuracy applications |
| text-embedding-3-small | 1536 | 8191 tokens | Efficient, general purpose |
| jina-embeddings-v2-base-en | 768 | 8192 tokens | English text optimization |
Example Usage
from openai import OpenAI
client = OpenAI(
api_key="your-api-key",
base_url="https://api.gately.ai/v1"
)
response = client.embeddings.create(
model="jina-embeddings-v3",
input=["Your text to convert to embeddings"]
)
embeddings = response.data[0].embedding
print(f"Generated embedding vector with {len(embeddings)} dimensions")
import OpenAI from "openai";
const openai = new OpenAI({
apiKey: "your-api-key",
baseURL: "https://api.gately.ai/v1"
});
const response = await openai.embeddings.create({
model: "jina-embeddings-v3",
input: ["Your text to convert to embeddings"]
});
const embeddings = response.data[0].embedding;
console.log(`Generated embedding vector with ${embeddings.length} dimensions`);
Response Format
The API returns a list of embedding vectors corresponding to each input text, along with usage information:{
"object": "list",
"data": [
{
"object": "embedding",
"embedding": [0.0023064255, -0.009327292, ...], // Vector of floating point numbers
"index": 0
}
],
"model": "jina-embeddings-v3",
"usage": {
"prompt_tokens": 8,
"total_tokens": 8
}
}
Best Practices
- Use consistent embedding models for related datasets
- For long texts, consider chunking into smaller segments
- Normalize embeddings if performing cosine similarity
- Cache embeddings for frequently used content
Was this page helpful?
⌘I

