---
title: "Create embeddings"
method: POST
path: "/ai/openai/embeddings"
tags: ["OpenAI Embeddings"]
---

# Create embeddings

`POST /ai/openai/embeddings`

Creates an embedding vector representing the input text. This endpoint is compatible with the [OpenAI Embeddings API](https://platform.openai.com/docs/api-reference/embeddings) and may be used with the OpenAI JS or Python SDK by setting the base URL to `https://api.telnyx.com/v2/ai/openai`.

## Request body

- OpenAIEmbeddingRequest
  - `input` union, required — Input text to embed. Can be a string or array of strings.
    - string — A single text string to embed
    - string[] — An array of text strings to embed
  - `model` string, required — ID of the model to use. Use the List embedding models endpoint to see available models.
  - `encoding_format` 'float' | 'base64' — The format to return the embeddings in.
  - `dimensions` integer — The number of dimensions the resulting output embeddings should have. Only supported in some models.
  - `user` string — A unique identifier representing your end-user for monitoring and abuse detection.

## Response `200`

Successful Response

- OpenAIEmbeddingResponse
  - `object` string, required — The object type, always 'list'
  - `data` OpenAIEmbeddingData[], required — List of embedding objects
    - `object` string, required — The object type, always 'embedding'
    - `embedding` number[], required — The embedding vector
    - `index` integer, required — The index of the embedding in the list of embeddings
  - `model` string, required — The model used for embedding
  - `usage` OpenAIEmbeddingUsage, required
    - `prompt_tokens` integer, required — Number of tokens in the input
    - `total_tokens` integer, required — Total number of tokens used

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.net/team-telnyx/apis/telnyx-api-2.md) · [All operations](https://skmtc.net/team-telnyx/apis/telnyx-api-2/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/team-telnyx/telnyx-api-2/revisions/8f5f4e537994/schema)
