---
title: "Create embeddings – Superbot API"
canonical_url: "https://superbot.gg/developers/gateway/createEmbedding"
summary: "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`."
---

> Markdown of https://superbot.gg/developers/gateway/createEmbedding. Site index: /llms.txt.

# Create embeddings

`POST /v1/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`.

- Operation id: `createEmbedding`
- Group: [Gateway](https://superbot.gg/developers/gateway.md)
- Auth: A caller key holding `gateway:invoke` (`Authorization: Bearer sbc_…` or `x-api-key: sbc_…`).
- Scopes: `gateway:invoke`
- Body reference: [OpenAI Embeddings reference](https://platform.openai.com/docs/api-reference/embeddings/create)

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

## Response 200

One vector per input, in input order.

`application/json`: EmbeddingList.

- `object` (string, required): One of `list`.
- `data` (array of object, required)
  - `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)
  - `prompt_tokens` (integer, required)
  - `total_tokens` (integer, required)

## Errors

Every refusal carries `error`, `message`, `doc_url` and `request_id`; the gateway routes answer in the dialect you dialed.

| Status | Codes | When |
| --- | --- | --- |
| 400 | [`invalid_request`](https://superbot.gg/developers#errors-invalid_request) | The body is not JSON, or the request is malformed or over the per-request token cap. |
| 401 | [`unauthorized`](https://superbot.gg/developers#errors-unauthorized) | Missing, malformed or unknown key. |
| 402 | — | Your credits or the key’s budget are spent. |
| 403 | [`insufficient_scope`](https://superbot.gg/developers#errors-insufficient_scope), `model_not_allowed`, `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 (`model_not_found`). |
| 413 | [`body_too_large`](https://superbot.gg/developers#errors-body_too_large) | The body is over the size limit. |
| 429 | [`rate_limited`](https://superbot.gg/developers#errors-rate_limited) | Over the per-key request bucket, or the embeddings model is rate limited (`Retry-After` names the wait). |
| 5XX | — | Embeddings are temporarily unavailable (503 `embeddings_unavailable`), billing could not be read, or the model failed to answer. |

## Examples

```sh
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"}'
```

```js
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())
```
