POST /v1/infer/embeddings
The OpenAI Embeddings API, for embedding models the node serves (`b3os.kind` is `embedding`). Other models return `404 model_not_available`; the beta node serves no embedding model yet. Bills input tokens.

Authentication

Bearer Token (b3os_sk_ API key or b3os_pat_ token) API Key (cookie: __Host-b3os_session)

Request Body required

application/json
model string REQUIRED
input string | string[] | integer[] | integer[][] REQUIRED
One of:
Option 1string
Option 2
Array of: string
Option 3
Array of: integer
Option 4
Array of:
Array of: integer
encoding_format string
Enum: float, base64
dimensions integer
user string

Responses

200 The embeddings.
application/json
object string REQUIRED
Enum: list
data object[] REQUIRED
Array of:
object string REQUIRED
Enum: embedding
index integer REQUIRED
embedding number[] | string REQUIRED
One of:
Option 1
Array of: number
Option 2string
model string REQUIRED
usage object REQUIRED
prompt_tokens integer REQUIRED
total_tokens integer REQUIRED
400 The request is invalid (`invalid_request`, `unsupported_parameter`, `context_length_exceeded`).
401 Missing or invalid credentials (`unauthorized`).
403 The key lacks `infer:run` or `infer:read` (`forbidden`), or the egress guard refused an image URL (`egress_denied`).
404 The model is not served on this node (`model_not_available`).
413 The request body exceeds the model's `max_request_bytes` (`payload_too_large`).
415 The body is not JSON (`unsupported_media_type`): send `Content-Type: application/json`.
429 A limit applies (`rate_limited` for requests, tokens or remote image bytes per minute, `concurrency_limited` for requests in flight for the organization, `quota_exceeded`; `credits_exhausted` arrives as 402).
500 Something failed inside B3OS (`internal`).
503 The model runtime, the voice service or the B3IQ gateway route is restarting, overloaded or not set up on this node (`infer_backend_unavailable`, `capacity_unavailable`), or the node is unavailable (`node_unavailable`).
curl -X POST 'https://beta-api.b3os.org/v1/infer/embeddings' \  -H 'Authorization: Bearer YOUR_API_TOKEN' \  -H 'Content-Type: application/json' \  -d '{  "model": "b3os/bge-m3",  "input": [    "The loop stays on one machine."  ]}'
const response = await fetch('https://beta-api.b3os.org/v1/infer/embeddings', {  method: 'POST',  headers: {      "Authorization": "Bearer YOUR_API_TOKEN",      "Content-Type": "application/json"  },  body: JSON.stringify({    "model": "b3os/bge-m3",    "input": [      "The loop stays on one machine."    ]  })});const data = await response.json();console.log(data);
import requestsheaders = {    'Authorization': 'Bearer YOUR_API_TOKEN'}response = requests.post('https://beta-api.b3os.org/v1/infer/embeddings', headers=headers, json={  "model": "b3os/bge-m3",  "input": [    "The loop stays on one machine."  ]})print(response.json())
200 Response
{  "object": "list",  "data": [    {      "object": "embedding",      "index": 0,      "embedding": [        0.0123,        -0.0456,        0.0789      ]    }  ],  "model": "b3os/bge-m3",  "usage": {    "prompt_tokens": 8,    "total_tokens": 8  }}
Ask a question... ⌘I