Embeddings
Convert text into vectors for semantic search, knowledge retrieval, text clustering and similarity matching.
Endpoint
http
POST https://api.nexusmodels.cn/v1/embeddingsHeaders
http
Authorization: Bearer YOUR_NEXUSMODELS_API_KEY
Content-Type: application/jsonRequest parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | Yes | Embedding model name |
input | string or array | Yes | Text to convert into vectors |
encoding_format | string | No | Vector encoding format, such as float |
dimensions | integer | No | Output dimensions, supported by selected models |
user | string | No | End-user identifier |
Single input example
bash
curl -sS -X POST \
'https://api.nexusmodels.cn/v1/embeddings' \
-H 'Authorization: Bearer YOUR_NEXUSMODELS_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"model": "YOUR_EMBEDDING_MODEL",
"input": "NexusModels provides a unified AI model API.",
"encoding_format": "float"
}'Batch input example
bash
curl -sS -X POST \
'https://api.nexusmodels.cn/v1/embeddings' \
-H 'Authorization: Bearer YOUR_NEXUSMODELS_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"model": "YOUR_EMBEDDING_MODEL",
"input": [
"The first document to embed.",
"The second document to embed."
],
"encoding_format": "float"
}'Response example
json
{
"object": "list",
"data": [
{
"object": "embedding",
"index": 0,
"embedding": [
0.0123,
-0.0456,
0.0789
]
}
],
"model": "YOUR_EMBEDDING_MODEL",
"usage": {
"prompt_tokens": 12,
"total_tokens": 12
}
}