API Endpoint Access URL
https://llm.pixlab.io/embedding
Get your API key and test text-embed ↗Description
The TEXT-EMBED API endpoint converts text into dense vector representations that capture semantic meaning, context, and topical similarity. It is a practical building block for retrieval-augmented generation, semantic search, support automation, text classification, clustering, deduplication, and content recommendation workflows.
Developers can send a sentence, paragraph, or longer text input and receive an embedding vector that is ready for indexing in vector databases, ranking pipelines, or downstream machine learning systems. The endpoint supports multilingual text processing and fits well in both product-facing features and internal knowledge workflows.
HTTP Methods
GET, POST
HTTP Parameters
Required
| Fields | Type | Description |
|---|---|---|
input |
string | The input text to convert into an embedding vector. A maximum of 8192 tokens is allowed per request. |
key |
String | Your PixLab API Key ↗. You can also send the key in the WWW-Authenticate HTTP header and omit this parameter. |
Optional
| Fields | Type | Description |
|---|---|---|
dimension |
integer | The output embedding vector dimension. Supported values are 512 and 1024. The default is 1024. |
POST Request Body
Use a POST request when you prefer sending the input in a JSON body instead of query parameters.
Allowed Content-Types:
application/json
For application/json requests, send the text value in the input field along with your API key and any optional parameters such as dimension. This endpoint is designed for text input and does not require file uploads.
HTTP Response
application/json
This endpoint returns a lightweight JSON response containing the generated embedding vector, model identifier, token usage, and any error details when a request fails.
Text Embedding Response Format
{
"status": 200,
"embedding": [2.8765, 1.9870, 4.9076],
"model": "pixlab-text-embed",
"total_tokens": 512
}
| Fields | Type | Description |
|---|---|---|
status |
Integer | HTTP 200 indicates success. Any other code indicates failure. |
embedding |
List | An array of floating-point values containing the generated text embedding vector. |
model |
String | Identifier of the embedding model used to process the request. |
total_tokens |
Integer | Total token count reported for the request. |
error |
String |
Error details returned when status != 200.
|
Code Samples
import requests
import json
# Generate text embedding vector for a given sentence or piece of text.
# Refer to: https://pixlab.io/endpoints/text-embed for the official documentation.
key = 'PIXLAB_API_KEY' # Get your API key from https://console.pixlab.io/
# Make the API call. Switch to POST if you prefer sending JSON in the request body.
req = requests.get('https://llm.pixlab.io/embedding',params={
'input': "What is the meaning of life?",
'key': key,
'dimension': 1024, # Desired output vector dimension
})
reply = req.json()
if reply['status'] != 200:
print (reply['error'])
else:
embedding = reply['embedding']
print(f"Text embedding vector: {embedding}")
// Generate text embedding vector for a given sentence or piece of text.
// Refer to: https://pixlab.io/endpoints/text-embed for the official documentation.
const key = 'PIXLAB_API_KEY'; // Get your API key from https://console.pixlab.io/
// Make the API call. Switch to POST if you prefer sending JSON in the request body.
fetch('https://llm.pixlab.io/embedding?input=What is the meaning of life?&key=' + key + '&dimension=1024')
.then(response => response.json())
.then(reply => {
if (reply['status'] !== 200) {
console.log(reply['error']);
} else {
const embedding = reply['embedding'];
console.log(`Text embedding vector: ${embedding}`);
}
})
.catch(error => {
console.error('Error:', error);
});
<?php
# Generate text embedding vector for a given sentence or piece of text.
# Refer to: https://pixlab.io/endpoints/text-embed for the official documentation.
$key = 'PIXLAB_API_KEY'; // Get your API key from https://console.pixlab.io/
# Make the API call. Switch to POST if you prefer sending JSON in the request body.
$ch = curl_init('https://llm.pixlab.io/embedding?input=What is the meaning of life?&key=' . $key . '&dimension=1024');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
$reply = json_decode($response, true);
if ($reply['status'] != 200) {
echo $reply['error'];
} else {
$embedding = $reply['embedding'];
echo "Text embedding vector: " . json_encode($embedding);
}
Similar API Endpoints
tagimg, nsfw, docscan, llm-parse, chat, llm-tools, answer, describe, image-embed, llm-tool-call, query, coder