Embeddings
Convert text into numerical vectors for semantic search and similarity matching.
POST
Convert text into numerical vectors for semantic search and similarity matching.
API endpoint
Generate embeddings for text input using GreenPT models.
POST /v1/embeddingsCreates an embedding vector representing the input text.
Code example
import OpenAI from 'openai';
const openai = new OpenAI();
const embedding = await openai.embeddings.create({
model: 'green-embedding',
input: 'Your text string goes here',
encoding_format: 'float',
});Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | Yes | ID of the model to use. Currently supports "green-embedding". |
input | string or array | Yes | Input text to embed, encoded as a string or an array of tokens. |
encoding_format | string | No | Format to return the embeddings in: "float" or "base64". Defaults to float. |
Response format
{
"object": "list",
"data": [
{
"object": "embedding",
"index": 0,
"embedding": [
-0.006929283495992422,
-0.005336422007530928,
-4.547132266452536e-05,
-0.024047505110502243
]
}
],
"model": "green-embedding",
"usage": {
"prompt_tokens": 5,
"total_tokens": 5
}
}Use cases
- Semantic search: find similar documents or text passages.
- Clustering: group similar content together.
- Recommendations: surface related content based on similarity.
- Classification: classify text into categories using embedding similarity.
- Anomaly detection: identify outliers in text data.
Models
green-embedding is backed by
Qwen3-Embedding-4B: a
multilingual (100+ languages) embedding model with a 32k token context and
Matryoshka Representation Learning, so output dimensions are configurable from
32 up to 2560.
See the full list of available models on the Models page.