GreenPT Docs

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/embeddings

Creates 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

ParameterTypeRequiredDescription
modelstringYesID of the model to use. Supports "green-embedding" and "qwen3-embedding-8b".
inputstring or arrayYesInput text to embed, encoded as a string or an array of tokens.
encoding_formatstringNoFormat 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 5-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 or degraded service

Independent of your own rate limit, this endpoint can also return 503 with a Retry-After header giving the seconds to wait, usually 5: with {"error": "Service temporarily at capacity. Please retry."} when demand exceeds available model capacity, or with {"error": "Service temporarily degraded. Please retry."} when the model is failing to respond. A model that times out returns 504 with the same degraded body and header. 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.

The two ids are not served by every host. qwen3-embedding-8b is the embedding id on the US endpoint https://api.us.greenpt.ai, as well as on the EU endpoints; green-embedding is EU only. See Region Inference.

See the full list of available models on the Models page.

On this page