Embeddings
POST /v1/embeddings — OpenAI-compatible text embeddings
/v1/embeddings is OpenAI-compatible and goes through the same routing/billing pipeline as chat — it has its own rate limiter, separate from chat/completions, so embedding traffic never competes with chat traffic for RPM/TPM.
The example model below is illustrative — check GET /v1/models for models whose capabilities include embedding before you build against this page (see Models).
Example
from openai import OpenAI
client = OpenAI(base_url="https://api.modelsite.ai/v1", api_key="ms_live_sk_xxx")
resp = client.embeddings.create(
model="bge-m3",
input=["The quick brown fox", "jumps over the lazy dog"],
)
for d in resp.data:
print(d.index, len(d.embedding))Request body
| Field | Type | Notes |
|---|---|---|
model | string | required |
input | string | string[] | required — one string or a batch of strings |
encoding_format | string | float (default) or base64 |
dimensions | integer | requested output vector size; support varies by model |
user | string | opaque end-user identifier, passed through where the vendor supports it |
A few vendor-specific fields are also accepted at the top level for models that need them: task_type + title (Vertex AI — e.g. RETRIEVAL_QUERY / RETRIEVAL_DOCUMENT), input_type (some Bedrock multimodal models — text / image / video / audio). Anything else vendor-specific goes in extra_body, same convention as Chat Completions.
Response
{
"object": "list",
"model": "bge-m3",
"data": [
{ "object": "embedding", "index": 0, "embedding": [0.0023, -0.009, "…"] },
{ "object": "embedding", "index": 1, "embedding": [0.0041, 0.002, "…"] }
],
"usage": { "prompt_tokens": 12, "total_tokens": 12 }
}embedding is a float array by default, or a base64-encoded string when encoding_format: "base64". Billing follows the same input_token dimension as chat.