Model APIs / Embeddings

# Embeddings

Vectors in the OpenAI shape, with the provider's own embeddings and the charge on every response.

`POST` `/v1/embeddings` `inference:invoke`[Browse embedding models →](https://yelno.ai/catalog?type=embeddings)

## Request

The OpenAI shape, so any OpenAI SDK's embeddings call works unchanged.

| Field | Required | Notes |
| --- | --- | --- |
| model | required | An embeddings model's id. |
| input | required | A string or a list of strings. |
| dimensions | optional | Vector size, for models that support it. |
| encoding_format | optional | How vectors are encoded, as in the OpenAI shape. |

Request

```
import os
from openai import OpenAI

client = OpenAI(base_url="https://yelno.ai/v1", api_key=os.environ["YELNO_API_KEY"])
res = client.embeddings.create(
    model="MODEL",
    input=["refund policy for damaged items", "shipping times to Canada"],
)
print(len(res.data), len(res.data[0].embedding))
```

## Response

200 · application/json

```
{
  "object": "list",
  "data": [
    { "object": "embedding", "index": 0, "embedding": [0.0123, -0.0456, …] },
    { "object": "embedding", "index": 1, "embedding": [ … ] }
  ],
  "model": "…",
  "usage": { … },
  "yelno": { … }
}
```

The vectors are the provider's, one per input, in input order.

Every JSON response carries the same `yelno` block a chat response does: `request_id`, `provider`, `model`, `endpoint_id`, `attempts` and `cost`. `cost` is `{state: "final", currency, customer_nanos}` when the provider reported the cost with the response, or `{state: "pending", currency, note}` when it reports it later — the charge then settles once. Errors use the standard [error envelope](https://yelno.ai/docs/errors); upstream text never reaches you.

Sending a model to a route it is not served on answers `422` `capability_unsupported` with `code: "operation_unsupported"` and a message naming the route that serves it. Every model in the [catalog](https://yelno.ai/catalog?type=embeddings) shows its type and route.

Source: https://yelno.ai/docs/embeddings
