# Embeddings

> POST /v1/embeddings — the OpenAI Embeddings contract.

URL: https://boelabs.com/en/docs/ai-gateway/embeddings
Language: English

Convert text into vectors with the OpenAI Embeddings contract. The public model must have a
deployment that supports the `embedding.create` operation.

## Example request

Set `GATEWAY` to the gateway origin and `API_KEY` to your virtual key. Replace the example
public model with one from [Model discovery](https://boelabs.com/docs/ai-gateway/models-discovery).

```bash
curl -X POST "$GATEWAY/v1/embeddings" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "model": "embed", "input": ["red fox", "blue whale"], "encoding_format": "float" }'
```

## Fields

`model`, `input` (a string, a string batch, pre-tokenized `number[]`/`number[][]`, depending on the
model's profile), `encoding_format` (`float` or `base64`), `dimensions`, `user`.

Every field is validated against the target model's `embedding.create` catalog profile before any
upstream call: `dimensions` is only honored when the model declares `supportsDimensions: true`;
`encoding_format: "base64"` is rejected unless the profile lists it; pre-tokenized input is rejected
unless `supportsTokenInput: true`. A rejected combination returns `400 unsupported_parameter`.

## Provider routing

OpenAI, Azure OpenAI, and OpenAI-compatible deployments route to the native `/embeddings` endpoint.
Google AI Studio routes to `:embedContent` (single input) or `:batchEmbedContents` (batch) — and, in
this gateway, accepts **text input and `float` vectors only**, regardless of what a custom profile might
otherwise allow. See [Providers → Google AI Studio](https://boelabs.com/docs/ai-gateway/providers-google).

## Next steps

- [Model catalog → Embeddings](https://boelabs.com/docs/ai-gateway/model-catalog#embeddings) — the full `embedding.create` schema.
- [Creating deployments](https://boelabs.com/docs/ai-gateway/creating-deployments#3-embeddings--catalog-model) — registering an embeddings model per provider.

