Embeddings
Convert text into numerical vectors for semantic search and similarity matching.
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. Supports "green-embedding" and "qwen3-embedding-8b". |
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
}
}Rate limits
Requests are limited per account (shared across all your API keys): 600
requests per 15-minute window, and shared across every GreenPT API
endpoint rather than counted separately per endpoint. Exceeding it returns
429 Too many requests, please try again later. with RateLimit-Limit,
RateLimit-Remaining, RateLimit-Reset, and Retry-After response
headers — read RateLimit-Remaining to track your usage against the
current window.
503 at high load
Independent of your own rate limit, this endpoint can also return 503
with {"error": "Service temporarily at capacity. Please retry."} and a
Retry-After: 5 header when demand exceeds available model capacity.
Retry after the delay.
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.
qwen3-embedding-8b is backed by
Qwen3-Embedding-8B: a larger
multilingual (100+ languages) embedding model with a 32k token context and
Matryoshka Representation Learning, so output dimensions are configurable from
32 up to 4096.
See the full list of available models on the Models page.