> ## Documentation Index
> Fetch the complete documentation index at: https://docs.redpill.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Embeddings

> Create text embeddings.

## Create Embeddings

Generate vector embeddings from text for semantic search, similarity, clustering, and retrieval.
Requests are served through the attested TEE gateway, which does not retain request bodies. Use
`is_tee` from the embedding catalog to find confidential-capable models and verify the receipt for
the actual request.

```bash theme={null}
POST https://api.redpill.ai/v1/embeddings
```

## Request Body

<ParamField body="model" type="string" required>
  Model id returned by `GET /v1/embeddings/models`.
</ParamField>

<ParamField body="input" type="string | string[]" required>
  Text to embed. Pass a single string or an array of strings for batch embedding.
</ParamField>

<ParamField body="encoding_format" type="string">
  `float` (default) or `base64`.
</ParamField>

<ParamField body="dimensions" type="integer">
  Optional output dimension count. Supported by `openai/text-embedding-3-small` and
  `openai/text-embedding-3-large`, which can return fewer dimensions than their default.
</ParamField>

## Example

<CodeGroup>
  ```bash cURL theme={null}
  curl https://api.redpill.ai/v1/embeddings \
    -H "Authorization: Bearer $REDPILL_AI_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "model": "qwen/qwen3-embedding-8b",
      "input": "Confidential AI you can verify."
    }'
  ```

  ```python Python theme={null}
  from openai import OpenAI

  client = OpenAI(
      api_key="YOUR_API_KEY",
      base_url="https://api.redpill.ai/v1",
  )

  resp = client.embeddings.create(
      model="qwen/qwen3-embedding-8b",
      input="Confidential AI you can verify.",
  )
  print(len(resp.data[0].embedding))
  ```

  ```javascript JavaScript theme={null}
  import OpenAI from "openai";

  const client = new OpenAI({
    baseURL: "https://api.redpill.ai/v1",
    apiKey: process.env.REDPILL_AI_API_KEY,
  });

  const resp = await client.embeddings.create({
    model: "qwen/qwen3-embedding-8b",
    input: "Confidential AI you can verify.",
  });
  console.log(resp.data[0].embedding.length);
  ```
</CodeGroup>

### Batch input

Pass an array to embed several strings in one request. Results are returned in input order, each with
its `index`.

```bash theme={null}
curl https://api.redpill.ai/v1/embeddings \
  -H "Authorization: Bearer $REDPILL_AI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "qwen/qwen3-embedding-8b",
    "input": ["first document", "second document"]
  }'
```

## Response

```json theme={null}
{
  "object": "list",
  "data": [
    { "object": "embedding", "index": 0, "embedding": [0.0167, -0.0557, "…"] }
  ],
  "model": "openai/text-embedding-3-small",
  "usage": { "prompt_tokens": 8, "total_tokens": 8 }
}
```

## Model catalog

The public `GET /v1/embeddings/models` catalog is authoritative. It accepts the same `zdr` filter as
the chat model catalog:

```bash theme={null}
curl -s "https://api.redpill.ai/v1/embeddings/models?zdr=true" \
  | jq -r '.data[].id'
```

Embedding requests accept the same `provider` routing block as chat completions, including
`zdr`, `aci_verified`, and `aci_session_ids`.
See [Zero data retention](/guides/zero-data-retention).

## Custom dimensions

`openai/text-embedding-3-small` and `openai/text-embedding-3-large` accept a `dimensions` parameter to
return shorter vectors, which reduces storage and speeds up similarity search at some cost to quality.

```bash theme={null}
curl https://api.redpill.ai/v1/embeddings \
  -H "Authorization: Bearer $REDPILL_AI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "openai/text-embedding-3-large",
    "input": "shorter vector",
    "dimensions": 1024
  }'
```

Keep one model and one dimension count per index. Vectors from different models are not comparable.

## Related

<CardGroup cols={2}>
  <Card title="Models" icon="list" href="/get-started/models">
    Chat and confidential models.
  </Card>

  <Card title="Trust boundary" icon="shield-halved" href="/confidential-ai/trust-boundary">
    What the gateway protects.
  </Card>
</CardGroup>
