---
title: "Create embeddings"
method: POST
path: "/embeddings"
tags: ["embeddings"]
---

# Create embeddings

`POST /embeddings`

Creates embedding vectors representing the input text.

Input can be a single string or an array of strings. Each input produces one embedding vector in the response.

## Request body

- EmbeddingRequest — Request body for embeddings.
  - `dimensions` integer, nullable — The number of dimensions the resulting output embeddings should have.
  - `encoding_format` string, nullable — The format to return the embeddings in ("float" or "base64").
  - `input` union, required — Input for embedding requests - can be a single string or array of strings.
    - string — A single string to embed.
    - string[] — An array of strings to embed.
  - `model` string, required — ID of the model to use.
  - `user` string, nullable — A unique identifier representing your end-user.

## Response `200`

Embeddings generated successfully. Each input string has a corresponding entry in the `data` array.

- EmbeddingResponse — Response from embeddings.
  - `data` EmbeddingData[], required — The list of embeddings generated.
    - `embedding` number[], required — The embedding vector.
    - `index` integer, required — The index of this embedding in the list.
    - `object` string, required — The object type, always "embedding".
  - `model` string, required — The model used for generating embeddings.
  - `object` string, required — The object type, always "list".
  - `usage` EmbeddingUsage, required — Usage statistics for embedding requests.
    - `prompt_tokens` integer, required — Number of tokens in the input.
    - `total_tokens` integer, required — Total number of tokens used.

## Other responses

- `400` — Invalid request — check that your input is a string or array of strings.
- `401` — Invalid or missing API key. Ensure your `Authorization` header is set to `Bearer YOUR_API_KEY`.
- `402` — Insufficient credits. Top up your account to continue making requests.
- `403` — Your API key does not have access to the requested model.
- `404` — The specified model does not exist. Use `GET /models` to list available models.
- `429` — Rate limit exceeded. Back off and retry after a short delay.
- `500` — An unexpected error occurred. Retry the request or contact support if the issue persists.

---

[API](https://skmtc.dev/doubleword/apis/doubleword-api.md) · [All operations](https://skmtc.dev/doubleword/apis/doubleword-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/doubleword/doubleword-api/revisions/6617202865d8/schema)
