> For the complete documentation index, see [llms.txt](https://netmind-power.gitbook.io/netmind-power-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://netmind-power.gitbook.io/netmind-power-documentation/api/inference/embedding-api.md).

# Embedding API

The Embedding API allows you to generate high-quality vector representations (embeddings) of text inputs. These embeddings can be used for a variety of tasks such as semantic search, text classification, clustering, and more. This API is fully compatible with the OpenAI SDK, making it easy to integrate into your existing workflows.

### Base URL

<https://api.netmind.ai/inference-api/openai/v1>

### Authentication

To use the API, you need to obtain a Netmind AI API Key. For detailed instructions, please refer to the [authentication documentation](/netmind-power-documentation/api/api-token.md).

### Supported Models

* nvidia/NV-Embed-v2
* dunzhang/stella\_en\_1.5B\_v5
* BAAI/bge-m3

### Usage Examples

#### Python Client

The Embedding API is compatible with the OpenAI Python SDK. Below is an example of how to use it

```python
from openai import OpenAI

# Initialize the client with NetMind API base URL and your API key
client = OpenAI(
    api_key="YOUR_API_KEY",
    base_url="https://api.netmind.ai/inference-api/openai/v1"
)

# Generate embeddings
response = client.embeddings.create(
    input="This is a sample text to embed.",
    model="nvidia/NV-Embed-v2",
    encoding_format="float" # only support float now
)

# Access the embedding
embedding = response.data[0].embedding
print(embedding)
```

#### CURL Example

```sh
# Set your API key
export API_KEY="<YOUR Netmind AI API Key>"

curl "https://api.netmind.ai/inference-api/openai/v1/embeddings" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer ${API_KEY}" \
  -d $'{
    "model": "nvidia/NV-Embed-v2",
    "input": "This is a sample text to embed.",
    "encoding_format": "float" # only support float now
}'
```

**BAAI/bge-m3 Example**

The `BAAI/bge-m3` model is a specialized embedding model designed to generate high-quality vector representations of text. It supports multiple encoding types, including `dense` (default), `sparse`, and `colbert` (Multi-Vector). For more details, please refer to the [Hugging Face model card](https://huggingface.co/BAAI/bge-m3).

```sh
# Set your API key
export API_KEY="<YOUR Netmind AI API Key>"

curl "https://api.netmind.ai/inference-api/openai/v1/embeddings" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer ${API_KEY}" \
  -d $'{
    "model": "BAAI/bge-m3",
    "input": "This is a sample text to embed.",
    "encoding_format": "float", # only support float now
    "encoding_type": "dense" # [dense, sparse, colbert]
}'
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://netmind-power.gitbook.io/netmind-power-documentation/api/inference/embedding-api.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
