# Embeddings

POST /v1/embeddings: turn text into vectors, billed per input token.

`POST https://ai.sivcloud.com/v1/embeddings` uses the OpenAI Embeddings format. The OpenAI SDK works unchanged except for the base URL and API key.

```bash
curl https://ai.sivcloud.com/v1/embeddings \
  -H "Authorization: Bearer $SIVCLOUD_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "openai/text-embedding-3-small",
    "input": "Hello world"
  }'
```

```python
from openai import OpenAI

client = OpenAI(base_url="https://ai.sivcloud.com/v1", api_key="SIVCLOUD_API_KEY")
res = client.embeddings.create(model="openai/text-embedding-3-small", input=["Hello world", "Good morning"])
print(len(res.data[0].embedding))
```

## Body

| Field | Meaning |
|---|---|
| `model` | Required. Embedding model id |
| `input` | Required. One text or a list of texts |
| `encoding_format` | Optional. `float` or `base64` |
| `dimensions` | Optional. Number of dimensions, if the model supports it |

The response is passed on from the provider in the OpenAI format.

## Cost

Embeddings are billed per **input token** (`usage.prompt_tokens`) at the model's input price. There are no output tokens. The cost is taken from your balance, or from a plan allowance when that allowance applies to the model. See [Subscriptions](https://sivcloud.com/en/docs/console/subscriptions/).

## Available models

The embedding models you can use are the ones shown on the Models page in the console. Chat models cannot be used on this endpoint, and the other way round. Errors use the codes on the [Errors](https://sivcloud.com/en/docs/errors/) page.
