API Endpoint Access URL
https://llm.pixlab.io/embedding
Get Your API Key & Try TEXT-EMBED Now ↗Description
The TEXT-EMBED API endpoint converts textual data into numerical vectors, capturing the semantic meaning and context of stream of words (tokens). It supports multiple mainstream languages and offers efficient embedding services for text data. This is useful for natural language processing tasks like RAG, text classification, sentiment analysis, and text indexing.
HTTP Methods
JSON POST
HTTP Parameters
Required
Fields | Type | Description |
---|---|---|
input |
string |
The input accepts various data types: a string, a list of strings. Text Input Constraints:
|
key |
String | Your PixLab API Key ↗. You can also embed your key in the WWW-Authenticate: HTTP header and omit this parameter if you want to. |
Optional
Fields | Type | Description |
---|---|---|
dimension |
integer | The output embedding vector dimension. The value must be either 512 or 1024. Defaults to 1024 . |
POST Request Body
This section outlines the requirements for POST requests, which are used instead of GET requests in specific scenarios.
Allowed Content-Types:
application/json
JSON is the default format for POST requests. If you are uploading a file via a JSON POST request, please ensure the file is base64 encoded within the JSON payload.
HTTP Response
application/json
The default response format is the PixLab simple LLM response format which is unified across our vLM API endpoints, and is suitable for most applications that includes the bare minimum information including the embedding vector, tokens count, etc.
PixLab Simple vLM Response Format
{
"status": 200,
"id": "6783E34342",
"embedding": [2.8765, 1.9870, 4.9076, 7.9177, ...],
"object": "embedding",
"created": 1694623155,
"model": "pix-llm",
"total_input_tokens": 25,
"total_output_tokens": 57,
}
Fields | Type | Description |
---|---|---|
status |
Integer | HTTP 200 indicates success. Any other code indicates failure. |
id |
Integer | random ID to identify the generated response output. |
embedding |
List | An array (or list) of floating points stream containing the complete output text embedding vector. |
object |
String | Invoked vLM API endpoint. |
created |
Timestamp | Timestamp of generated output creation. |
model |
String | Underlying LLM model ID/Name. |
total_input_tokens |
Integer | total number of ingested tokens. |
total_output_tokens |
Integer | Total number of output tokens. |
error |
String | Error description when status != 200. |
Code Samples
# For a comprehensive list of production-ready code samples, please consult the PixLab Github Repository: https://github.com/symisc/pixlab.
// For a comprehensive list of production-ready code samples, please consult the PixLab Github Repository: https://github.com/symisc/pixlab.
<?php
# For a comprehensive list of production-ready code samples, please consult the PixLab Github Repository: https://github.com/symisc/pixlab.
Similar API Endpoints
tagimg, nsfw, docscan, llm-parse, chat, llm-tools, answer, describe, image-embed, llm-tool-call, query, coder