> For the complete documentation index, see [llms.txt](https://docs.nebulablock.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.nebulablock.com/products/serverless-inference/embeddings.md).

# Embeddings

Turn text into vectors for semantic search and RAG with Nebula Block's embedding models.

Embedding models are machine learning models that convert data (such as text, images, or code) into dense numerical vectors in a continuous space. These vectors, called embeddings, capture the semantic relationships between different pieces of data, enabling efficient comparison and retrieval.

## Models available

| Model                   | Model ID                  | Notes                                                                   |
| ----------------------- | ------------------------- | ----------------------------------------------------------------------- |
| Qwen3-Embedding-8B 🇨🇦 | `Qwen/Qwen3-Embedding-8B` | Strong multilingual and code support, top MTEB scorer, hosted in Canada |

See the [Model Catalog](/products/serverless-inference/model-catalog.md#embeddings) for the current list.

## Using the model

### Through the API

This option is to use our API endpoint directly in your projects. Below are some code snippets to get you started!

> **NOTE:** Don't forget to use **your** API key. See the [API Reference](/api-reference/authentication.md) and the [Overview](/account/api-keys.md) for more details on authentication.

#### Using cURL

```bash
curl -X POST "https://inference.nebulablock.com/v1/embeddings" \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer $NEBULA_API_KEY" \
    --data-raw '{
      "model":"Qwen/Qwen3-Embedding-8B",
      "input":[ 
            "Bananas are berries, but strawberries are not, according to botanical classifications.",  
            "The Eiffel Tower in Paris was originally intended to be a temporary structure." 
        ] 
    }'
```

#### Using Python

```python
import requests 
import os

url = "https://inference.nebulablock.com/v1/embeddings" 

headers = {  
    "Content-Type": "application/json",  
    "Authorization": f"Bearer {os.environ.get('NEBULA_API_KEY')}" 
} 

data = {
    "model":"Qwen/Qwen3-Embedding-8B",
    "input":[ 
        "Bananas are berries, but strawberries are not, according to botanical classifications.", 
        "The Eiffel Tower in Paris was originally intended to be a temporary structure." 
    ] 
}

response = requests.post(url, headers=headers, json=data) 
print(response.json())
```

#### Using JavaScript

```javascript
const url = 'https://inference.nebulablock.com/v1/embeddings';

const headers = {
    "Content-Type": "application/json",
    "Authorization": `Bearer ${process.env.NEBULA_API_KEY}`
};

const data = {
    "model": "Qwen/Qwen3-Embedding-8B",
    "input": [
        "Bananas are berries, but strawberries are not, according to botanical classifications.",
        "The Eiffel Tower in Paris was originally intended to be a temporary structure."
    ]
};

fetch(url, {
    method: 'POST',
    headers: headers,
    body: JSON.stringify(data)
})
    .then(response => response.json())
    .then(data => {
        console.log(JSON.stringify(data, null, 2));
    })
    .catch(error => console.error('Error:', error));
```

#### Selecting a model

Pass the model ID from the table above as the `model` field.

#### Response Example

A successful response body will return the embeddings in this format:

```json
{
    "model": "Qwen/Qwen3-Embedding-8B",
    "data": [
        
      {
            "embedding": [
                -0.373046875,
                ..., 
                0.248046875
            ],
            "index": 0,
            "object": "embedding"
        },
        {
            "embedding": [
                -0.50390625,
                ...,
                0.01409912109375
            ],
            "index": 1,
            "object": "embedding"
        }
    ],
    "object": "list",
    "usage": {
        "completion_tokens": 0,
        "prompt_tokens": 33,
        "total_tokens": 33,
        "completion_tokens_details": null,
        "prompt_tokens_details": null
    }
}
```

> **NOTE:** Notice that there are 2 embeddings, each with its own index number. These embeddings correspond to the given input sentences, of which there are 2. You can choose how many sentences to create embeddings for, this is just an example.

For every parameter and response field, see the [Embeddings API reference](/api-reference/inference-api/embeddings.md).

## See also

* [Reranking](/products/serverless-inference/reranking.md) — reorder retrieved documents before sending them to a model
* [Embeddings API reference](/api-reference/inference-api/embeddings.md)
* [Model Catalog](/products/serverless-inference/model-catalog.md)
