> ## Documentation Index
> Fetch the complete documentation index at: https://docs.openp.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# embedContent

> POST /v1beta/models/{model}:embedContent — Gemini embedding vectors

Get Gemini embedding vectors. You can also batch via `:batchEmbedContents`.

## Request

```bash theme={null}
curl "https://openp.ai/v1beta/models/text-embedding-004:embedContent" \
  -H "x-goog-api-key: $OPENPAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "content": {"parts": [{"text": "hello world"}]}
  }'
```

### Fields

| Field                  | Type    | Required | Description                                                                                        |
| ---------------------- | ------- | :------: | -------------------------------------------------------------------------------------------------- |
| `content.parts`        | array   |     ✅    | Array of text segments                                                                             |
| `taskType`             | string  |          | `RETRIEVAL_QUERY` / `RETRIEVAL_DOCUMENT` / `SEMANTIC_SIMILARITY` / `CLASSIFICATION` / `CLUSTERING` |
| `title`                | string  |          | Can be attached when `taskType=RETRIEVAL_DOCUMENT`                                                 |
| `outputDimensionality` | integer |          | Truncate dimensions (`gemini-embedding-001` only)                                                  |

## Response

```json theme={null}
{
  "embedding": {
    "values": [0.012, -0.034, ..., 0.001]
  }
}
```

## Batch embedding

```bash theme={null}
curl "https://openp.ai/v1beta/models/text-embedding-004:batchEmbedContents" \
  -H "x-goog-api-key: $OPENPAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "requests": [
      {"model": "models/text-embedding-004", "content": {"parts": [{"text": "a"}]}},
      {"model": "models/text-embedding-004", "content": {"parts": [{"text": "b"}]}}
    ]
  }'
```

Returns:

```json theme={null}
{
  "embeddings": [
    {"values": [...]},
    {"values": [...]}
  ]
}
```
