curl -X POST https://api-llm.sunra.ai/v1/embeddings \
-H "Authorization: Bearer <SUNRA_KEY>" \
-H "Content-Type: application/json" \
-d '{
"model": "google/gemini-embedding-2",
"input": [
"The quick brown fox jumps over the lazy dog.",
"Sunra is a platform for AI models."
],
"dimensions": 768
}'
import requests
response = requests.post(
"https://api-llm.sunra.ai/v1/embeddings",
headers={
"Authorization": "Bearer <SUNRA_KEY>",
"Content-Type": "application/json"
},
json={
"model": "google/gemini-embedding-2",
"input": [
"The quick brown fox jumps over the lazy dog.",
"Sunra is a platform for AI models."
],
"dimensions": 768
}
)
print(response.json())
const response = await fetch("https://api-llm.sunra.ai/v1/embeddings", {
method: "POST",
headers: {
"Authorization": "Bearer <SUNRA_KEY>",
"Content-Type": "application/json"
},
body: JSON.stringify({
model: "google/gemini-embedding-2",
input: [
"The quick brown fox jumps over the lazy dog.",
"Sunra is a platform for AI models."
],
dimensions: 768
})
});
const data = await response.json();
console.log(data);
{
"object": "list",
"data": [
{
"object": "embedding",
"index": 0,
"embedding": [0.011253, -0.020551, 0.049236, "..."]
},
{
"object": "embedding",
"index": 1,
"embedding": [0.031744, 0.008122, -0.014307, "..."]
}
],
"model": "google/gemini-embedding-2",
"usage": {
"prompt_tokens": 18,
"total_tokens": 18
}
}
LLM
Create embeddings
POST
/
v1
/
embeddings
curl -X POST https://api-llm.sunra.ai/v1/embeddings \
-H "Authorization: Bearer <SUNRA_KEY>" \
-H "Content-Type: application/json" \
-d '{
"model": "google/gemini-embedding-2",
"input": [
"The quick brown fox jumps over the lazy dog.",
"Sunra is a platform for AI models."
],
"dimensions": 768
}'
import requests
response = requests.post(
"https://api-llm.sunra.ai/v1/embeddings",
headers={
"Authorization": "Bearer <SUNRA_KEY>",
"Content-Type": "application/json"
},
json={
"model": "google/gemini-embedding-2",
"input": [
"The quick brown fox jumps over the lazy dog.",
"Sunra is a platform for AI models."
],
"dimensions": 768
}
)
print(response.json())
const response = await fetch("https://api-llm.sunra.ai/v1/embeddings", {
method: "POST",
headers: {
"Authorization": "Bearer <SUNRA_KEY>",
"Content-Type": "application/json"
},
body: JSON.stringify({
model: "google/gemini-embedding-2",
input: [
"The quick brown fox jumps over the lazy dog.",
"Sunra is a platform for AI models."
],
dimensions: 768
})
});
const data = await response.json();
console.log(data);
{
"object": "list",
"data": [
{
"object": "embedding",
"index": 0,
"embedding": [0.011253, -0.020551, 0.049236, "..."]
},
{
"object": "embedding",
"index": 1,
"embedding": [0.031744, 0.008122, -0.014307, "..."]
}
],
"model": "google/gemini-embedding-2",
"usage": {
"prompt_tokens": 18,
"total_tokens": 18
}
}
टेक्स्ट या मीडिया इनपुट से एम्बेडिंग वेक्टर बनाता है। केवल-टेक्स्ट अनुरोध प्रत्येक इनपुट के लिए एक वेक्टर लौटाते हैं, जो रिट्रीवल, सिमेंटिक सर्च, क्लस्टरिंग, वर्गीकरण और RAG के लिए उपयोगी है। मीडिया (base64 data URI के रूप में इमेज, ऑडियो या वीडियो) वाले अनुरोध सभी इनपुट को एक ही क्रॉस-मोडल वेक्टर में फ्यूज़ कर देते हैं — यदि आपको प्रत्येक एसेट के लिए एक वेक्टर चाहिए, तो प्रत्येक एसेट को उसके अपने अलग अनुरोध में एम्बेड करें। OpenAI Embeddings API प्रारूप के साथ संगत है। इस एंडपॉइंट पर स्ट्रीमिंग समर्थित नहीं है।
प्रमाणीकरण
string
आवश्यक
Bearer टोकन। Authorization हेडर में अपनी API कुंजी को bearer टोकन के रूप में उपयोग करें।प्रारूप:
Bearer <SUNRA_KEY>अनुरोध
यह एंडपॉइंट एक ऑब्जेक्ट स्वीकार करता है।string
आवश्यक
उपयोग किए जाने वाले एम्बेडिंग मॉडल की ID, जैसे
google/gemini-embedding-2। उपलब्ध एम्बेडिंग मॉडल के लिए मॉडल पेज देखें।string | string[]
आवश्यक
एम्बेड करने के लिए इनपुट, एक स्ट्रिंग या स्ट्रिंग्स की एक सरणी के रूप में। केवल-टेक्स्ट इनपुट स्वतंत्र रूप से एम्बेड किए जाते हैं और इनपुट क्रम में प्रत्येक इनपुट के लिए एक वेक्टर लौटाते हैं। मीडिया इनपुट base64 data URI के रूप में पास किए जाते हैं (
data:image/png;base64,…, data:audio/mpeg;base64,…, data:video/mp4;base64,…) और इन्हें टेक्स्ट के साथ मिलाया जा सकता है — लेकिन मीडिया वाला कोई भी अनुरोध सभी इनपुट के संयोजन के लिए एक ही फ्यूज़्ड वेक्टर लौटाता है। सीमाएँ (अपस्ट्रीम): प्रति अनुरोध अधिकतम 6 इमेज, वीडियो अधिकतम 120 सेकंड, और सभी मोडैलिटी में कुल 8,192 टोकन का साझा बजट (टेक्स्ट टोकन; प्रत्येक इमेज 258 टोकन, ऑडियो 25 टोकन/सेकंड, वीडियो 66 टोकन/सेकंड के रूप में गिना जाता है)।integer
आउटपुट एम्बेडिंग के लिए आयामों की संख्या। केवल लचीले आउटपुट आयामों वाले मॉडल (Matryoshka Representation Learning) द्वारा समर्थित।
google/gemini-embedding-2 के लिए डिफ़ॉल्ट 3072 है, और 128 से 3072 तक के मान समर्थित हैं। छोटे मान वेक्टर को छोटा कर देते हैं जबकि अधिकांश सिमेंटिक गुणवत्ता बनाए रखते हैं।string
लौटाए गए एम्बेडिंग का प्रारूप।
float (डिफ़ॉल्ट) या base64 में से एक।प्रतिक्रिया
string
हमेशा
list।object[]
string
एम्बेडिंग बनाने के लिए उपयोग किया गया मॉडल।
object
अनुरोध के लिए टोकन उपयोग। एम्बेडिंग केवल इनपुट टोकन पर बिल की जाती हैं, मोडैलिटी-विशिष्ट दरों के साथ (मूल्य निर्धारण के लिए मॉडल पेज देखें)। मीडिया अनुरोधों में प्रति-मोडैलिटी टोकन गणनाएँ शामिल होती हैं।
दिखाएं usage object
दिखाएं usage object
integer
टेक्स्ट इनपुट टोकन की संख्या।
integer
इमेज इनपुट टोकन (258 प्रति इमेज)। केवल तब मौजूद जब अनुरोध में इमेज शामिल हों।
integer
ऑडियो इनपुट टोकन (25 प्रति सेकंड)। केवल तब मौजूद जब अनुरोध में ऑडियो शामिल हो।
integer
वीडियो इनपुट टोकन (66 प्रति सेकंड)। केवल तब मौजूद जब अनुरोध में वीडियो शामिल हो।
integer
सभी मोडैलिटी में कुल इनपुट टोकन (एम्बेडिंग कोई आउटपुट टोकन उत्पन्न नहीं करती)।
curl -X POST https://api-llm.sunra.ai/v1/embeddings \
-H "Authorization: Bearer <SUNRA_KEY>" \
-H "Content-Type: application/json" \
-d '{
"model": "google/gemini-embedding-2",
"input": [
"The quick brown fox jumps over the lazy dog.",
"Sunra is a platform for AI models."
],
"dimensions": 768
}'
import requests
response = requests.post(
"https://api-llm.sunra.ai/v1/embeddings",
headers={
"Authorization": "Bearer <SUNRA_KEY>",
"Content-Type": "application/json"
},
json={
"model": "google/gemini-embedding-2",
"input": [
"The quick brown fox jumps over the lazy dog.",
"Sunra is a platform for AI models."
],
"dimensions": 768
}
)
print(response.json())
const response = await fetch("https://api-llm.sunra.ai/v1/embeddings", {
method: "POST",
headers: {
"Authorization": "Bearer <SUNRA_KEY>",
"Content-Type": "application/json"
},
body: JSON.stringify({
model: "google/gemini-embedding-2",
input: [
"The quick brown fox jumps over the lazy dog.",
"Sunra is a platform for AI models."
],
dimensions: 768
})
});
const data = await response.json();
console.log(data);
{
"object": "list",
"data": [
{
"object": "embedding",
"index": 0,
"embedding": [0.011253, -0.020551, 0.049236, "..."]
},
{
"object": "embedding",
"index": 1,
"embedding": [0.031744, 0.008122, -0.014307, "..."]
}
],
"model": "google/gemini-embedding-2",
"usage": {
"prompt_tokens": 18,
"total_tokens": 18
}
}
⌘I