
# Embeddings

Turn text into embedding vectors from a single API call — for semantic search, clustering, deduplication, or feeding a vector index. Backed by **Amazon Bedrock Titan Text Embeddings v2**. Embed a single string or a batch in one request; pricing is **metered per started 10 KB of input** — no per-token math, no monthly minimum.

```bash
curl -X POST https://api.relaystation.ai/v1/llm/embed \
  -H 'Authorization: Bearer rs_live_<key>' \
  -H 'Idempotency-Key: embed-20260707' \
  -H 'Content-Type: application/json' \
  -d '{ "input": "the quick brown fox", "dimensions": 1024 }'
```

Or on the lodestone path — no account, a signed x402 payment instead of an API key:

```bash
curl -X POST https://api.relaystation.ai/v1/llm/embed \
  -H 'X-Payment: <base64 EIP-3009 authorization>' \
  -H 'Idempotency-Key: embed-20260707' \
  -H 'Content-Type: application/json' \
  -d '{ "input": "the quick brown fox", "dimensions": 1024 }'
```

## Request

`POST /v1/llm/embed`:

| Field | Type | Notes |
|---|---|---|
| `input` | string **or** string[], required | one text, or a batch of up to **100** strings |
| `dimensions` | integer | output vector size — one of `256`, `512`, `1024` (default `1024`). A smaller vector is cheaper to store and search |
| `normalize` | boolean | return unit-normalized vectors (recommended for cosine similarity) |

A batch embeds every string in one call — cheaper and lower-latency than N single calls.

```bash
curl -X POST https://api.relaystation.ai/v1/llm/embed \
  -H 'Authorization: Bearer rs_live_<key>' \
  -H 'Idempotency-Key: embed-batch-20260707' \
  -H 'Content-Type: application/json' \
  -d '{ "input": ["first chunk", "second chunk", "third chunk"], "dimensions": 512, "normalize": true }'
```

## Response

```json
{
  "embeddings": [
    { "index": 0, "vector": [0.0123, -0.0456, ...], "inputTokens": 4 }
  ],
  "model": "...",
  "dimensions": 1024
}
```

Each entry carries its `index` (matching the input order), the `vector`, and the `inputTokens` counted for that string. The chosen `dimensions` must match the frozen index shape if you plan to write these vectors into a [vector baton](/docs/rag) — the allowlisted sizes (`256` / `512` / `1024`) are exactly the vector-baton dimension options.

## Billing

Metered **per started 10 KB of input** across the whole request (a batch is billed on its combined input size). Priced per unit; see [Pricing](/pricing) for the current rate, or send an unauthenticated `POST` to read the exact price from the `402` challenge. Every billable call needs an `Idempotency-Key`; a same-key retry returns the cached vectors without re-charging.

## Where embeddings go next

Embeddings are the substrate for retrieval. Write them into a **vector baton** and query top-k, or let [RAG](/docs/rag) embed, retrieve, and answer in one call — see [Vector search & RAG](/docs/rag).

## MCP tools

Callable over MCP at `https://api.relaystation.ai/mcp` as `embed`. Same auth, same pricing as the HTTP route.

## Next

[Vector search & RAG](/docs/rag) · [LLM tasks](/docs/llm-tasks) · [Quickstart](/docs/quickstart) · [x402 wire format](/docs/x402) · [API reference](/api-reference)
