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

# Embeddings endpoint

> The embeddings API endpoint allows you to easily convert some text into embedding vectors. This feature gives you the possibility to manage your own vector database while keeping the advantages of Paradigm.

Convert text into numerical vector representations that capture semantic meaning. This is essential for building search systems, recommendation engines, and similarity detection features.

<Note>
  Embeddings are high-dimensional vectors (typically 384 to 1536 dimensions) that encode semantic meaning. Similar texts will have similar embeddings, making them perfect for semantic search and clustering tasks.
</Note>

## Prerequisites

* A **Paradigm API key**: if you do not have one, go to your Paradigm profile (`/settings/api-key` in your instance) and generate a new API key.
* The desired **embedding model available in Paradigm**: By default the embedding model used for the chat with docs should be available. If you want to use another embedding model, you must add it to Paradigm from the admin interface.

<Tip>
  Use the same embedding model consistently across your application. Mixing embeddings from different models will produce unreliable similarity results.
</Tip>

## Usage methods

There are several ways to call the endpoint:

1. With the **python `requests` package**
2. Through a **curl request**: for quick testing or first-time use

## Python `requests` package

You can directly send request to the API endpoint through the `requests` package.

```python theme={null}
import requests
import os

# Get API key and base URL from environment
api_key = os.getenv("PARADIGM_API_KEY")
base_url = os.getenv("PARADIGM_BASE_URL", "https://paradigm.lighton.ai/api/v2")

response = requests.request(
    method="POST",
    url=f"{base_url}/embeddings",
    headers={
        'accept': "application/json",
        'Authorization': f"Bearer {api_key}"
    },
    json={
        "model": "multilingual-e5-large",
        "input": "This a test string"
    }
)

print(response.json())
```

You would then get a JSON answer as a dictionary:

```json theme={null}
{
    "object": "list",
    "data": [
        {
            "object": "embedding",
            "embedding": [
                0.0071225623,
                -0.008990367,
                "...",
                -0.023343408,
                0.016777039
            ],
            "index": 0
        }
    ],
    "model": "multilingual-e5-large",
    "usage": {
        "prompt_tokens": 6,
        "total_tokens": 6
    },
    "id": "fe922faf-50bd-4f5f-90a0-4abd0de10a78"
}
```

## cURL request

If you would prefer sending a request to Paradigm with a simple cURL command, here is an example:

```shell theme={null}
curl --request POST \
  --url $PARADIGM_BASE_URL/embeddings \
  --header "Authorization: Bearer $PARADIGM_API_KEY" \
  --header 'accept: application/json' \
  --data '{
  "model": "multilingual-e5-large",
  "input": "This a test string"
}'
```
