GPT-5.5 & Codex API access - $19/week, $76/month, or $59 first month with UNLIMITED59 when configuredSee packagesvs OpenAI API

Embeddings

Use embedding responses with an OpenAI-compatible request.

Check request and response handling for search, retrieval, clustering, and recommendation workflows with returned vectors while keeping keys server-side and usage visible.

Last updated: July 6, 2026. Examples use safe placeholders and do not include real API keys, secrets, or customer data.

Recommended first use

Start with a small batch, store vectors with source metadata, then add queueing, retries, and rate-limit monitoring before indexing a large corpus.

Setup path

Four steps from text to a returned vector shape.

Step 1

Authenticate server-side

Use an API key with embeddings:write scope from trusted server-side code.

Open section

Step 2

Send text input

Post one string or an array of strings to the OpenAI-compatible embeddings endpoint.

Open section

Step 3

Read vectors with metadata

Validate the returned vector shape with your document ID, source, and any search filters your product needs.

Open section

Step 4

Monitor usage

Track request count, prompt tokens, rate state, and 429 responses before large indexing jobs.

Open section

Endpoint

Post text to the embeddings endpoint.

Use the OpenAI-compatible /v1 endpoint with a scoped server-side key. Keep raw content out of logs unless your data policy allows it.

Embeddings endpoint requirements and notes.
ItemValueNotes
MethodPOSTSend JSON to the embeddings endpoint.
Endpointhttps://unlimitedcodex.com/v1/embeddingsUse the same /v1 base URL as chat completions and image request validation.
AuthorizationBearer tokenUse a scoped API key with embeddings:write access.
Content typeapplication/jsonThe request body must be valid JSON.

Request shape

Send one input or a small batch.

The smallest useful request includes a model and input. Use array input when your client can map each returned index to a source record.

Embeddings request fields, status, and notes.
FieldStatusNotes
modelRecommendedPass an embedding model value explicitly. Use the model value from your delivered setup details.
inputRequiredSend one non-empty string or an array of non-empty strings.
encoding_formatOptionalUse float for numeric vectors or base64 when your storage layer prefers an encoded payload.
const response = await fetch("https://unlimitedcodex.com/v1/embeddings", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.UCX_API_KEY}`,
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    model: "ucx-embedding-3-small",
    input: [
      "Release checklist for a safe API launch.",
      "Rate states and usage review before rollout."
    ],
    encoding_format: "float"
  })
});

const body = await response.json();

if (!response.ok) {
  throw new Error(body.error?.code ?? "embedding_request_failed");
}

const vectors = body.data.map((item) => item.embedding);

Response shape

Store the vector and the source context together.

The response includes one embedding object per input plus usage fields for reporting and cost review.

Embeddings response fields, meanings, and notes.
FieldMeaningNotes
objectlistIdentifies the response as a list of embedding objects.
data[].embeddingnumber[] or base64Matches the requested encoding_format.
data[].indexinput positionUse this to map array inputs back to source records.
usage.prompt_tokensinput token countCounts the text volume used for usage reporting and rate-limit review.
{
  "object": "list",
  "id": "embd_example",
  "model": "ucx-embedding-3-small",
  "data": [
    {
      "object": "embedding",
      "index": 0,
      "embedding": [0.1221, -0.7442, 0.0314]
    }
  ],
  "usage": {
    "prompt_tokens": 18,
    "total_tokens": 18
  }
}
{
  "model": "ucx-embedding-3-small",
  "input": "Short text to index.",
  "encoding_format": "base64"
}

Limits and errors

Treat indexing as a rate-aware job.

Embedding workloads can grow quickly when a corpus changes. Build progress tracking, retries, and rate checks into your indexing pipeline.

The endpoint returns OpenAI-compatible vectors so teams can confirm parsing, usage reporting, and storage behavior before larger embeddings workloads.

Embedding requests count as one request plus prompt tokens.

Array input is useful for small batches, but large indexing jobs should use your own queue and backoff.

The endpoint returns a complete list response; embeddings are not streamed.

Use 429 handling from the rate-limit guide before indexing a large corpus.

Do not send secrets, regulated data, or customer text unless your agreement permits that use.

FAQ

Embeddings questions.

Can I send multiple texts in one embeddings request?

Yes. The input field accepts one non-empty string or an array of non-empty strings. The response includes an index for each returned embedding.

Which scope does an embeddings key need?

Use an API key with embeddings:write scope. Keep the key server-side and send it as a Bearer token.

Do embeddings stream?

No. The embeddings endpoint returns a complete list response with data and usage fields.

How should I handle large indexing jobs?

Chunk work into small batches, store progress in your own system, retry transient failures with backoff, and pause on rate pressure until capacity changes.

Next step

Pair embeddings with auth, rate limits, and error handling.

Before indexing customer-facing content, confirm key scope, data handling rules, rate-limit behavior, and retry policy.