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
}
}
Creates embedding vectors from text or media inputs. Text-only requests return one vector per input, useful for retrieval, semantic search, clustering, classification, and RAG. Requests containing media (images, audio, or video as base64 data URIs) fuse all inputs into a single cross-modal vector — embed each asset in its own request when you need one vector per asset. Compatible with the OpenAI Embeddings API format. Streaming is not supported on this endpoint.
Authentication
string
required
Bearer token. Use your API key as the bearer token in the Authorization header.Format:
Bearer <SUNRA_KEY>Request
This endpoint expects an object.string
required
ID of the embedding model to use, e.g.
google/gemini-embedding-2. See the models page for available embedding models.object
Optional provider routing preferences. Omit for automatic routing. See Provider routing for supported fields and provider discovery.
string | string[]
required
Inputs to embed, as a single string or an array of strings. Text-only inputs are embedded independently, returning one vector per input in input order. Media inputs are passed as base64 data URIs (
data:image/png;base64,…, data:audio/mpeg;base64,…, data:video/mp4;base64,…) and may be mixed with text — but any request containing media returns a single fused vector for all inputs combined. Limits (upstream): at most 6 images per request, video up to 120 seconds, and a combined budget of 8,192 tokens across all modalities (text tokens; images count 258 tokens each, audio 25 tokens/second, video 66 tokens/second).integer
The number of dimensions for the output embeddings. Only supported by models with flexible output dimensions (Matryoshka Representation Learning). For
google/gemini-embedding-2 the default is 3072, and values from 128 to 3072 are supported. Smaller values truncate the vector while preserving most semantic quality.string
The format of the returned embeddings. Either
float (default) or base64.Response
string
Always
list.object[]
string
The model used to create the embeddings.
object
Token usage for the request. Embeddings are billed on input tokens only, with modality-specific rates (see the model page for pricing). Media requests include per-modality token counts.
Show usage object
Show usage object
integer
Number of text input tokens.
integer
Image input tokens (258 per image). Present only when the request contains images.
integer
Audio input tokens (25 per second). Present only when the request contains audio.
integer
Video input tokens (66 per second). Present only when the request contains video.
integer
Total input tokens across all modalities (embeddings produce no output tokens).
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