Skip to content
OpenRelay is in early access, and the /v1 API is stable. New capabilities ship in the changelog.
Inference API

Embeddings

POST /v1/embeddings, the OpenAI-compatible embeddings endpoint, its request and response shapes, limits, and input-only billing.

Turn text into vectors for search, retrieval, clustering, and deduplication. The endpoint follows the OpenAI Embeddings API shape, so the OpenAI SDKs' embeddings.create works against it unchanged.

POST https://inference.openrelay.inc/v1/embeddings

The model that serves this family is openrelay/bge-m3, BAAI's BGE-M3: a multilingual embedding model (100+ languages in one vector space) that returns 1024-dimension dense vectors. Check a model's supported_apis on GET /v1/models for embeddings; a model that does not list it answers 400 unsupported_api.

Request

FieldTypeDescription
modelstring (required)openrelay/bge-m3.
inputstring or array of strings (required)The text to embed. An array embeds each item independently and returns one vector per item, in order.

stream is dropped: an embeddings response is always a single JSON body.

Response

{
  "object": "list",
  "data": [
    { "object": "embedding", "index": 0, "embedding": [0.0213, -0.0487, 0.0112] },
    { "object": "embedding", "index": 1, "embedding": [0.0198, -0.0502, 0.0131] }
  ],
  "model": "openrelay/bge-m3",
  "usage": { "prompt_tokens": 18, "total_tokens": 18 }
}

Each embedding has 1024 values; the example is shortened. index is the position of the item in input. usage.prompt_tokens counts every input's tokens, and total_tokens equals it: there is no completion_tokens.

Limits

LimitValue
Tokens per input item8192
Items per request1024
Request body10 MiB (413 payload_too_large over it)

Split longer documents into chunks of 8192 tokens or fewer, and larger jobs into requests of 1024 items or fewer. A request over either limit is rejected with a 4xx; see Errors.

Billing

openrelay/bge-m3 costs $0.013 per 1M input tokens. It has no output rate, because it generates no tokens. You are billed on usage.prompt_tokens. See Pricing & billing.

Embeddings can also run through the Batch API with endpoint: "/v1/embeddings", at the batch rate.

Examples

curl https://inference.openrelay.inc/v1/embeddings \
  -H "Authorization: Bearer $OPENRELAY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "openrelay/bge-m3",
    "input": ["How do I cancel my subscription?", "¿Cómo cancelo mi suscripción?"]
  }'

On this page