---
title: "OpenAI embeddings"
method: POST
path: "/v1/embeddings"
---

# OpenAI embeddings

`POST /v1/embeddings`

## Request

- Base URL: `https://api.agentlab.cresclab.com`
- URL: `https://api.agentlab.cresclab.com/v1/embeddings`
- Auth: one of:
  - HTTP bearer
  - API key in header `x-api-key`
- TypeScript: <https://skmtc.dev/cresclab/apis/agent-lab-ai-gateway/docs/v1/embeddings/post.ts> (a function with typed inputs; its response is checked against the schema)

Relayed to an embeddings model as sent, apart from model. The model is named; auto is refused. Members other than model, input, dimensions, encoding_format and user are refused. Settled by the input tokens the provider reports.

## Headers

- `Idempotency-Key` string

## Request body

- object
  - `model` string, required: An embeddings model enabled for the workspace.
  - `input` unknown, required
  - `dimensions` integer
  - `encoding_format` 'float' | 'base64'
  - `user` string: Recorded as the request's end user.

## Response `200`

The embeddings, as the provider answered with model replaced.

- object

## Other responses

- `400`: Refused request. See the error catalog.
- `401`: Missing or not accepted key.
- `403`: Not allowed for this key or workspace.
- `429`: Rate limited or out of allowance. Retry-After and X-Should-Retry say whether to retry.
- `502`: The provider failed to answer.
- `503`: Gateway unavailable or settlement pending.

---

[API](https://skmtc.dev/cresclab/apis/agent-lab-ai-gateway.md) - [All operations](https://skmtc.dev/cresclab/apis/agent-lab-ai-gateway/llms.txt) - [OpenAPI document](https://skmtc.dev/cresclab/apis/agent-lab-ai-gateway/revisions/5dc08011cbe9?raw)
