Create embeddings
OpenAI Embeddings: text-embedding-3-small or text-embedding-3-large, billed to your credits at the vendor’s list price times the standard markup. Any OpenAI-compatible client works unchanged (a token-array input included). At most 2,048 inputs and about 300,000 tokens a request. Nothing of the request or the vectors is kept. The embedding ids are not listed on GET /v1/models.
Part of Gateway, 9 operations. The overview covers keys, scopes and errors.
POST /v1/embeddings
A caller key holding gateway:invoke (Authorization: Bearer sbc_… or x-api-key: sbc_…).
Request body
modelstring requiredThe embedding model. One of
text-embedding-3-small,text-embedding-3-large.inputstring | array of string | array of integer | array of array of integer requiredA text, a list of texts, a token array, or a list of token arrays. At most 2,048 inputs and about 300,000 tokens a request.
dimensionsintegerThe vector size; absent, the model’s own (1536 small, 3072 large).
encoding_formatstringfloat(the default) orbase64(one base64 string of little-endian float32 per vector). One offloat,base64.userstringAccepted and not forwarded.
Body reference: OpenAI Embeddings reference.
Response 200
One vector per input, in input order.
objectstring requiredOne of
list.dataarray of object required3 fields
objectstring requiredOne of
embedding.indexinteger requiredembeddingarray of number | string requiredThe vector: floats, or a base64 string when
encoding_formatisbase64.
modelstring requiredusageobject required2 fields
prompt_tokensinteger requiredtotal_tokensinteger required
Errors
| Status | Code | What to change |
|---|---|---|
| 400 | invalid_request | A parameter or body field is invalid; |
| 401 | unauthorized | Send a live caller key or session as |
| 402 | Your credits or the key’s budget are spent. | |
| 403 | insufficient_scope | The key lacks the scope in |
| 403 | model_not_allowed | Revoked · paused · insufficient_scope · model_not_allowed · model_plan_gated (the API needs a paid plan). |
| 403 | model_plan_gated | Revoked · paused · insufficient_scope · model_not_allowed · model_plan_gated (the API needs a paid plan). |
| 404 | model_not_found | The model is not an embedding model served here ( |
| 413 | body_too_large | The body is over the route’s size cap. |
| 429 | rate_limited | Over the per-key request bucket; retry after |
| 5XX | Embeddings are temporarily unavailable (503 |
curl
curl -sS -X POST "https://superbot.gg/v1/embeddings" \
-H "Authorization: Bearer $SUPERBOT_API_KEY" \
-H "content-type: application/json" \
-d '{"model":"text-embedding-3-small","input":"your-input"}'JavaScript
const res = await fetch(`https://superbot.gg/v1/embeddings`, {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.SUPERBOT_API_KEY}`,
'content-type': 'application/json',
},
body: JSON.stringify({"model":"text-embedding-3-small","input":"your-input"}),
});
console.log(res.status, await res.json());Python
import os
import requests
res = requests.request(
"POST",
"https://superbot.gg/v1/embeddings",
headers={
"Authorization": f"Bearer {os.environ['SUPERBOT_API_KEY']}",
"content-type": "application/json",
},
json={"model":"text-embedding-3-small","input":"your-input"},
)
print(res.status_code, res.json())200 One vector per input, in input order.
{
"object": "list",
"data": [
{
"object": "embedding",
"index": 0,
"embedding": "your-embedding"
}
],
"model": "your-model",
"usage": {
"prompt_tokens": 0,
"total_tokens": 0
}
}400 The body is not JSON, or the request is malformed or over the per-request token cap.
"string"401 Missing, malformed or unknown key.
"string"402 Your credits or the key’s budget are spent.
"string"403 Revoked · paused · insufficient_scope · model_not_allowed · model_plan_gated (the API needs a paid plan).
"string"404 The model is not an embedding model served here (`model_not_found`).
"string"413 The body is over the size limit.
"string"429 Over the per-key request bucket, or the embeddings model is rate limited (`Retry-After` names the wait).
"string"5XX Embeddings are temporarily unavailable (503 `embeddings_unavailable`), billing could not be read, or the model failed to answer.
"string"No operation matches this filter.