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

# Create embeddings from a local runtime.

OpenAI-compatible embeddings against an installed local runtime that serves the embedding modality. Pass a `model` id from `GET /v1/models`. Returns a Problem (503) when no reachable runtime can serve embeddings. 

` POST /v1/embeddings `

Create embeddings from a local runtime.

OpenAI-compatible embeddings against an installed local runtime that
serves the embedding modality. Pass a `model` id from `GET /v1/models`.
Returns a Problem (503) when no reachable runtime can serve embeddings.


## Servers

- ` http://127.0.0.1:8831 ` — Default local host-agent listener.

## Authentication

The operation accepts these alternatives. Schemes within one alternative are required together.

### Alternative 1

- ` LocalBearer `: ` http `

  - HTTP scheme: ` bearer ` (b3iq_local)

  - Local API key with local chat scope.

### Alternative 2

- ` LocalAPIKeyHeader `: ` apiKey `

  - Credential: ` X-B3IQ-API-Key ` in ` header `

  - Alternate header for local API keys.

### Alternative 3

- ` SetupBearer `: ` http `

  - HTTP scheme: ` bearer `

  - Setup token before operator configuration, or an authenticated operator session outside this spec.

### Alternative 4

- ` RouterSignedHeaders `: ` apiKey `

  - Credential: ` X-B3IQ-Router-Signature ` in ` header `

  - Router HMAC signature headers are used only by B3IQ router dispatch.

## Request body (required)

Content type: ` application/json `

- ` value `: type ` object `

  - Required fields: ` model `, ` input `

  - ` model `: type ` string `

  - ` input `: type ` unknown ` — A string, or an array of strings, to embed.

    - ` oneOf alternative 1 `: type ` string `

    - ` oneOf alternative 2 `: type ` array `

      - ` array item `: type ` string `

  - ` runtime_id `: type ` string ` — Optional local runtime override.

## Responses

### ` 200 ` — OpenAI-compatible embeddings response.

Content type: ` application/json `

- ` value `: type ` object `

  - ` object `: type ` string `

  - ` model `: type ` string `

  - ` data `: type ` array `

    - ` array item `: type ` object `

      - ` object `: type ` string `

      - ` index `: type ` integer `

      - ` embedding `: type ` array `

        - ` array item `: type ` number `

  - ` usage `: type ` object `

### ` default ` — B3IQ-native problem response.

Content type: ` application/json `

- ` value `: type ` object `

  - Required fields: ` error `

  - ` error `: type ` object `

    - Required fields: ` status `, ` title `, ` detail `

    - ` status `: type ` integer `

    - ` title `: type ` string `

    - ` detail `: type ` string `

    - ` code `: type ` string ` — Stable B3IQ code when present. See docs/error-codes.md.

## Request examples

### cURL

```curl
curl -X POST 'http://127.0.0.1:8831/v1/embeddings' \
  -H 'Authorization: Bearer YOUR_API_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
  "model": "string",
  "input": "string",
  "runtime_id": "string"
}'
```

### JavaScript

```javascript
const response = await fetch('http://127.0.0.1:8831/v1/embeddings', {
  method: 'POST',
  headers: {
      "Authorization": "Bearer YOUR_API_TOKEN",
      "Content-Type": "application/json"
  },
  body: JSON.stringify({
    "model": "string",
    "input": "string",
    "runtime_id": "string"
  })
});

const data = await response.json();
console.log(data);
```

### Python

```python
import requests

headers = {
    'Authorization': 'Bearer YOUR_API_TOKEN'
}

response = requests.post('http://127.0.0.1:8831/v1/embeddings', headers=headers, json={
  "model": "string",
  "input": "string",
  "runtime_id": "string"
})
print(response.json())
```