Embeddings
POST /v1/embeddings generates vector embeddings for input text using any provider and model available through Arbitex Gateway. It is a drop-in replacement for the OpenAI embeddings endpoint — change only the base URL and API key. The 5-tier DLP pipeline (Tier 0: TF-IDF, Tier 1: Regex, Tier 2: NER, Tier 3: DeBERTa, Tier 4: CredInt) inspects the embedding input text before it is forwarded to the upstream provider.
Endpoint
Section titled “Endpoint”POST https://api.arbitex.ai/v1/embeddingsContent-Type: application/jsonAuthorization: Bearer arb_live_your-api-key-hereRequest body
Section titled “Request body”| Field | Type | Required | Description |
|---|---|---|---|
model |
string | Yes | Provider and model identifier in provider/model-id format. Example: openai/text-embedding-3-small. Omitting the provider prefix triggers automatic resolution against your configured provider list. |
input |
string or string[] | Yes | The text to embed. Pass a single string or an array of strings to embed multiple inputs in one request. Each string is inspected by the DLP pipeline independently. |
dimensions |
integer | No | Number of dimensions in the output embedding vector. Only supported by models that allow dimension reduction (e.g. openai/text-embedding-3-small, openai/text-embedding-3-large). Forwarded to the upstream provider unchanged. |
encoding_format |
string | No | Output format for the embedding values. Accepted values: float (default) or base64. Forwarded to the upstream provider unchanged. |
Fields not listed here that are valid in the OpenAI embeddings API are forwarded to the upstream provider unchanged if the provider supports them. Unknown fields are silently dropped.
Response
Section titled “Response”The response follows the standard OpenAI embeddings response format. Arbitex adds policy decision headers to every response.
Response body
Section titled “Response body”{ "object": "list", "data": [ { "object": "embedding", "index": 0, "embedding": [0.0023064255, -0.009327292, 0.015797347, "..."] } ], "model": "text-embedding-3-small", "usage": { "prompt_tokens": 8, "total_tokens": 8 }}| Field | Description |
|---|---|
object |
Always "list". |
data |
Array of embedding objects, one per input string, in the same order as the input array. |
data[].object |
Always "embedding". |
data[].index |
Zero-based index corresponding to the position of the input string. |
data[].embedding |
The embedding vector as an array of floats (or a base64-encoded string if encoding_format: "base64"). |
model |
The model that produced the embeddings, as returned by the upstream provider. |
usage.prompt_tokens |
Number of tokens in the input text. |
usage.total_tokens |
Total tokens billed. For embeddings this equals prompt_tokens. |
Response headers
Section titled “Response headers”Every response includes policy decision metadata and rate-limit state:
| Header | Description |
|---|---|
X-Policy-Action |
The terminal action taken by the Policy Engine: ALLOW, BLOCK, CANCEL, or REDACT. Always present. |
X-Matched-Rule |
The ID of the specific rule that matched. Omitted when action is ALLOW. |
X-Request-ID |
The unique request identifier, matching request_id in the audit log. |
X-RateLimit-Limit |
Maximum requests permitted in the current rate limit window. |
X-RateLimit-Remaining |
Requests remaining in the current window. |
X-RateLimit-Reset |
Unix timestamp when the current window resets. |
DLP inspection of embedding input
Section titled “DLP inspection of embedding input”The 5-tier DLP pipeline inspects the text in input before it is forwarded to the upstream embedding provider, the same way it inspects chat messages. The policy action determines what happens next:
| Action | Behaviour |
|---|---|
ALLOW |
Input forwarded to the provider unchanged. |
REDACT |
Sensitive spans in each input string are replaced with the configured placeholder (default [REDACTED]) before the text is sent to the provider. The returned embeddings represent the redacted text, not the original. X-Policy-Action: REDACT is set on the response. |
BLOCK |
The request is rejected immediately. The upstream provider is never contacted. Returns 403 with code: "policy_block". No embeddings are returned. |
When REDACT is applied, the embeddings in the response are computed from the redacted text. Downstream similarity search or classification results will reflect the redacted representation. If your application requires embeddings of the original text, review your DLP policy configuration — consider whether the content legitimately needs to reach the embedding provider under your data handling policy.
Code examples
Section titled “Code examples”curl https://api.arbitex.ai/v1/embeddings \ -H "Authorization: Bearer $ARBITEX_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "openai/text-embedding-3-small", "input": "Enterprise content security protects sensitive data across all AI channels." }'Response:
{ "object": "list", "data": [ { "object": "embedding", "index": 0, "embedding": [0.0023064255, -0.009327292, 0.015797347, "..."] } ], "model": "text-embedding-3-small", "usage": { "prompt_tokens": 12, "total_tokens": 12 }}Batch input (array of strings)
Section titled “Batch input (array of strings)”curl https://api.arbitex.ai/v1/embeddings \ -H "Authorization: Bearer $ARBITEX_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "openai/text-embedding-3-small", "input": [ "Quarterly earnings report for Q1 2026.", "Summary of PCI DSS compliance controls." ] }'Python (OpenAI SDK)
Section titled “Python (OpenAI SDK)”from openai import OpenAI
client = OpenAI( base_url="https://api.arbitex.ai/v1", api_key="arb_live_your-api-key-here",)
response = client.embeddings.create( model="openai/text-embedding-3-small", input="Enterprise content security protects sensitive data across all AI channels.",)
vector = response.data[0].embeddingprint(f"Embedding dimensions: {len(vector)}")The OpenAI SDK passes Authorization: Bearer automatically. No other SDK configuration changes are needed — only base_url and api_key differ from a direct OpenAI call.
Node.js (OpenAI SDK)
Section titled “Node.js (OpenAI SDK)”import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.arbitex.ai/v1", apiKey: "arb_live_your-api-key-here",});
const response = await client.embeddings.create({ model: "openai/text-embedding-3-small", input: "Enterprise content security protects sensitive data across all AI channels.",});
const vector = response.data[0].embedding;console.log(`Embedding dimensions: ${vector.length}`);OpenAI compatibility
Section titled “OpenAI compatibility”The embeddings endpoint is a drop-in replacement for the OpenAI /v1/embeddings endpoint. Any client, SDK, or tool that targets OpenAI embeddings works against Arbitex Gateway without code changes beyond the base URL and API key.
The provider/model-id format lets you route to non-OpenAI embedding providers through the same endpoint:
"model": "openai/text-embedding-3-small""model": "openai/text-embedding-3-large"Additional providers are available depending on your organization’s configured provider list. Contact your Arbitex account representative or check Settings > Providers in the admin portal to see which embedding models are enabled for your organization.
Error codes
Section titled “Error codes”| Code | HTTP status | Description |
|---|---|---|
policy_block |
403 | A BLOCK policy rule matched the input. No embeddings are returned. |
invalid_api_key |
401 | API key not found, revoked, or malformed. |
model_not_found |
404 | The requested provider/model-id is not recognized or not available for your organization. |
context_length_exceeded |
400 | One or more input strings exceed the model’s token limit. |
invalid_request |
400 | Malformed request body — missing required fields or invalid types. |
quota_exceeded |
429 | Rate limit or token budget exceeded. Retry after X-RateLimit-Reset. |
provider_unavailable |
503 | All configured providers are unavailable. Retry with exponential backoff. |
See also
Section titled “See also”- Gateway API overview — authentication, rate limiting, and error codes
- Chat completions — full reference for
POST /v1/chat/completions - Policy decisions — how
BLOCK,REDACT, andROUTE_TOactions are determined - Policy Engine overview — configuring rules and packs
- DLP Overview — how the 5-tier DLP pipeline (Tier 0: TF-IDF, Tier 1: Regex, Tier 2: NER, Tier 3: DeBERTa, Tier 4: CredInt) inspects input text
- Audit log — querying the per-request audit record