skip to content
superbot.gg

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_…).

Operation id createEmbedding in Gateway.

Request body

application/json, required.

  • model string required

    The embedding model. One of text-embedding-3-small, text-embedding-3-large.

  • input string | array of string | array of integer | array of array of integer required

    A 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.

  • dimensions integer

    The vector size; absent, the model’s own (1536 small, 3072 large).

  • encoding_format string

    float (the default) or base64 (one base64 string of little-endian float32 per vector). One of float, base64.

  • user string

    Accepted and not forwarded.

Body reference: OpenAI Embeddings reference.

Response 200

One vector per input, in input order.

application/json: EmbeddingList.

  • object string required

    One of list.

  • data array of object required
    3 fields
    • object string required

      One of embedding.

    • index integer required
    • embedding array of number | string required

      The vector: floats, or a base64 string when encoding_format is base64.

  • model string required
  • usage object required
    2 fields
    • prompt_tokens integer required
    • total_tokens integer required

Errors

StatusCodeWhat to change
400invalid_request

A parameter or body field is invalid; param names it and issues lists every problem.

401unauthorized

Send a live caller key or session as Authorization: Bearer … or x-api-key. No key yet: create one at /account/api, or sign a user in at /auth.md.

402

Your credits or the key’s budget are spent.

403insufficient_scope

The key lacks the scope in required_scopes; mint a key that holds it.

403model_not_allowed

Revoked · paused · insufficient_scope · model_not_allowed · model_plan_gated (the API needs a paid plan).

403model_plan_gated

Revoked · paused · insufficient_scope · model_not_allowed · model_plan_gated (the API needs a paid plan).

404model_not_found

The model is not an embedding model served here (model_not_found).

413body_too_large

The body is over the route’s size cap.

429rate_limited

Over the per-key request bucket; retry after x-ratelimit-reset.

5XX

Embeddings are temporarily unavailable (503 embeddings_unavailable), billing could not be read, or the model failed to answer.

view .mdopenapi
Request

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())
Response

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"