---
title: "Embedding"
method: POST
path: "/embedding"
---

# Embedding

`POST /embedding`

## Request

- Base URL: `https://api.octen.ai`
- URL: `https://api.octen.ai/embedding`
- Auth: one of:
  - HTTP bearer
  - API key in header `x-api-key`

Converts text into vector representations. Supports batch input, multiple models, and configurable output dimensions.

## Request body

- EmbeddingRequest
  - `input` string[], required: The text to be converted into embeddings. Maximum characters per element: 10000. Maximum request body size: 2MB
  - `model` 'octen-embedding-0.6b' | 'octen-embedding-4b' | 'octen-embedding-8b': The embedding model used for this request. `octen-embedding-0.6b` (max dim: 1024) for cost/throughput priority; `octen-embedding-4b` (max dim: 2560) for most applications; `octen-embedding-8b` (max dim: 4096) for accuracy-critical tasks.
  - `dimension` integer: The dimensionality of the output embedding vectors. Defaults to the model's max dimension (0.6b: 1024, 4b: 2560, 8b: 4096). If set to a value smaller than the model default, the embedding will be truncated to the first N values. Any positive integer ≤ model default dimension is allowed.
  - `input_type` 'query' | 'document', nullable: Specifies whether the input is a query or a document for retrieval. Different values apply different internal prompts: `query` → "Represent the query for retrieving supporting" (prepended and counted in input_tokens); `document` and `null` mean no special prompt is applied.

## Response `200`

Successful embedding response

- EmbeddingResponse
  - `code` integer: Business status code. 0 indicates success.
  - `msg` string: A message describing the result.
  - `request_id` string: The unique identifier for this request.
  - `data` EmbeddingData: The main embedding response payload.
    - `results` EmbeddingResult[]: A list of embedding results. Each item corresponds to one input.
      - `index` integer: The position of the embedding in the input array (useful when input is a list).
      - `embedding` number[]: The generated embedding vector.
    - `model` string: The embedding model used for this request.
  - `meta` EmbeddingMeta: Additional metadata for the embedding request.
    - `usage` EmbeddingUsage: Usage information for the embedding request.
      - `input_tokens` integer: The number of input tokens processed in this request.
    - `warning` string, nullable: Optional warning message.

## Other responses

- `400`: Missing required parameter — Returned when a required parameter is missing.
- `401`: Invalid API Key — Returned when the API key is missing or invalid.
- `403`: Insufficient balance in account — Returned when the account balance is insufficient to complete the request.
- `429`: Exceeding the rate limit — Returned when the request exceeds the configured rate limit.
- `500`: Internal error — Returned when an unexpected server-side error occurs.

---

[API](https://skmtc.dev/octen/apis/octen-api.md) - [All operations](https://skmtc.dev/octen/apis/octen-api/llms.txt) - [OpenAPI document](https://skmtc.dev/octen/apis/octen-api/revisions/aaa6caaf46b0?raw)
