# Embeddings (/docs/embeddings)


Endpoint [#endpoint]

```
POST /v1/embeddings
```

Request [#request]

```json
{
  "model": "model-id",
  "input": "The quick brown fox jumps over the lazy dog.",
  "encoding_format": "float"
}
```

Parameters [#parameters]

| Parameter         | Type         | Required | Description                           |
| ----------------- | ------------ | -------- | ------------------------------------- |
| `model`           | string       | Yes      | Embedding model ID                    |
| `input`           | string/array | Yes      | Text(s) to embed                      |
| `encoding_format` | string       | No       | `float` (default) or `base64`         |
| `dimensions`      | integer      | No       | Output dimensions (if model supports) |

Response [#response]

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

Batch Embeddings [#batch-embeddings]

Embed multiple texts in a single request:

```python
response = client.embeddings.create(
    model="model-id",
    input=[
        "First document text",
        "Second document text",
        "Third document text"
    ]
)

for item in response.data:
    print(f"Index {item.index}: {len(item.embedding)} dimensions")
```

Available Models [#available-models]

Use the Models API to query available embedding models:

```bash
curl https://api.yuhuanstudio.com/v1/models?type=embedding \
  -H "Authorization: Bearer YOUR_API_KEY"
```

<Callout type="info">
  Embedding models and dimensions vary by provider. Check the dashboard for current availability.
</Callout>

Use Cases [#use-cases]

* **Semantic search** — Find documents similar to a query
* **Clustering** — Group similar texts together
* **Classification** — Categorize text by comparing embeddings
* **RAG** — Retrieval-Augmented Generation pipelines
