---
title: "Embeddings"
description: "POST /v1/embeddings — Generate vector embeddings for text"
---

Generate vector embeddings for text input. Use with `jade-mole-4`.

## Endpoint

```
POST /v1/embeddings
```

## Request body

| Parameter | Type | Required | Description |
|---|---|---|---|
| `model` | string | Yes | Must be `jade-mole-4`. |
| `input` | string or array | Yes | Text(s) to embed. |
| `encoding_format` | string | No | `float` (default) or `base64`. |

## Example request

```bash
curl https://api.liutong.llby.org/v1/embeddings \
  -H "Authorization: Bearer lt_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "jade-mole-4",
    "input": "Liutong makes LLM inference affordable."
  }'
```

## Response

```json
{
  "object": "list",
  "data": [
    {
      "object": "embedding",
      "index": 0,
      "embedding": [0.0023, -0.0091, 0.0152, ...]
    }
  ],
  "model": "jade-mole-4",
  "usage": {
    "prompt_tokens": 7,
    "total_tokens": 7
  }
}
```

## Batch input

Pass an array to embed multiple texts in one request:

```bash
curl https://api.liutong.llby.org/v1/embeddings \
  -H "Authorization: Bearer lt_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "jade-mole-4",
    "input": [
      "First document.",
      "Second document.",
      "Third document."
    ]
  }'
```

Each item in the `data` array corresponds to the input at the same index.

## Error responses

| Status | Description |
|---|---|
| 401 | Invalid or missing API key. |
| 400 | Malformed request body. |
| 404 | Model not found. |
| 500 | Internal server error. |
