Text Embeddings

Encode one or more texts into 384-dimensional dense vectors

You send a `texts` array; the service returns one 384-dim float vector per input plus the `dimensions` count and a `model` identifier. Use the vectors for semantic search indexing, clustering, duplicate detection, or as features for downstream ML. Synchronous; batch input is supported. Pricing note: cost is **per request**, not per text in the batch — sending 100 texts in one call still costs $0.002.

textanalysisnlp

Overview

Features

Dense 384-dim vectors

Each text is encoded to a fixed 384-dimensional float array on the live model. Vectors are L2-normalised.

Batch in one request

Send any number of texts in `texts` and pay one per-request fee.

Multilingual

Texts in different languages are mapped into the same vector space.

Self-describing response

The response includes `dimensions` and a `model` identifier so you can sanity-check vectors before storing them.

Use Cases

Search indexing

Embed documents and store vectors in a vector database for similarity search.

Clustering

Cluster documents, users, or products by embedding similarity.

Duplicate detection

Compare embeddings to find near-duplicate content.

Feature input

Use embeddings as features for classification, recommendation, or other ML pipelines.

Input / Output

Input

texts: array of strings

JSON body

Output

embeddings (array of float arrays), dimensions (int), model (string)

JSON

Specs

Latency
~0.2-1 s (batch is faster per text)
Async
false
Rate Limit
Per API key
Max Input
Embedding model dependent — long texts are truncated by the upstream

Quickstart

Prerequisites

  • -A CN8 Gateway API key with text-embeddings in allowed_services

1. Embed a single text

text-embeddings

Even for one input, send a 1-element texts array.

POST/v1/proxy/text-embeddings
{
  "texts": ["Machine learning is a subset of artificial intelligence."]
}

Response

{
  "status": "success",
  "data": {
    "embeddings": [[-0.0344, 0.0310, 0.0067, "...384 floats..."]],
    "dimensions": 384,
    "model": "unknown"
  }
}

2. Batch embed multiple texts

text-embeddings

Send all texts in one request. Cost is per-request — same price for 1 or 100 texts.

POST/v1/proxy/text-embeddings
{
  "texts": [
    "First document to embed.",
    "Second document to embed."
  ]
}

Response

{
  "status": "success",
  "data": {
    "embeddings": [
      [-0.0344, 0.0310, "...384 floats..."],
      [ 0.0157, -0.0421, "...384 floats..."]
    ],
    "dimensions": 384,
    "model": "unknown"
  }
}

embeddings is always a list of vectors (even for 1 text). The single-text legacy `embedding` field is NOT returned.

Text Embeddings

POSTsync

Encode a list of texts into 384-dim float vectors. Always batch-shaped output.

/v1/proxy/text-embeddings

Pricing

Billed per request.

ServiceUnitPrice
Text Embeddingsitem$0.002/request
  • -Cost is per request, NOT per text. Batch as many texts as fit in your payload to amortise the fee.

Guides & Tips

Important Notes (verified against the live upstream)

  • -Field name is `texts` (plural array). The legacy single-text `text` form is rejected.
  • -Cost is per request, not per text — batching is essentially free past the first item.
  • -`embeddings` is always a list-of-lists, even when you sent one text. There is no
  • -single-text `embedding` field on the live response.
  • -`dimensions` is 384 today. The `model` field returns `"unknown"` for now — treat
  • -it as informational, not contractual.

How it works

  • -Each text is tokenised and passed through a sentence embedding model.
  • -Token embeddings are mean-pooled and L2-normalised — cosine similarity equals a dot product.
  • -Output is a fixed 384-dim float array per text, in the same order as the input array.

Choosing a distance metric

  • -With normalised vectors (default), cosine similarity = dot product. Either works.
  • -Euclidean distance also works but cosine is the convention.

FAQ

Q: Why does my batch of 100 texts cost the same as 1?

A: By design — embeddings are billed per request. Batch aggressively to keep cost down.

Q: What's the embedding dimension?

A: 384 on the live model. The response also includes a `dimensions` field for sanity checking.

Q: What model is used?

A: The upstream currently returns `"model": "unknown"`. The vectors are stable across calls, so it's safe to store and reuse them — just refresh if the model field changes in the future.

Related Products

Changelog

1.2 (2026-04-29)

  • -Aligned to live upstream: request body is `texts` (array), response always returns `embeddings` (list of vectors).
  • -Removed legacy single-text `text` request field and single-text `embedding` response field — neither is supported.
  • -Documented per-REQUEST pricing (not per-text) — batching is essentially free past the first item.
  • -Confirmed live dimension is 384; documented `model` field (currently `"unknown"`).

1.1 (2026-02-23)

  • -Aligned with text_embedder prose (now superseded).

1.0 (2026-01-26)

  • -Initial catalog.