nexusflow
Online
Embeddings / Alibaba Cloud

Text Embeddings API

Convert text into high-dimensional embedding representations for semantic search, text clustering, recommendation systems, and other scenarios. The API uses synchronous invocation, returning embedding results immediately after the request, with no polling needed.

Request Endpoint

POSThttps://nexusflow.vip/v1/embeddings

Supported Models

Model IDProviderEmbedding DimensionsPrice
text-embedding-v4Alibaba Cloud2048/1536/1024/768/512/256/128/64¥0.5/million tokens

Request Parameters

ParametersTypeRequiredDescription
modelstring*Embedding model ID, fixed value: text-embedding-v4.
inputstring | string[]*Text to be embedded. Can be a single string or a string array (batch processing).
encoding_formatstring-Embedding encoding format in the response. Options: "float" (default) or "base64".

Code Examples

curl -X POST 'https://nexusflow.vip/v1/embeddings' \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "text-embedding-v4",
    "input": "NexusFlow is a unified large model API platform"
  }'

Response Format

{
  "object": "list",
  "data": [
    {
      "object": "embedding",
      "index": 0,
      "embedding": [0.0023064255, -0.009327292, 0.015797347, ...]
    }
  ],
  "model": "text-embedding-v4",
  "usage": {
    "prompt_tokens": 12,
    "total_tokens": 12
  }
}

Response Fields

FieldTypeDescription
objectstringFixed value "list", indicating the response is an embedding list.
data[].embeddingarrayFloat embedding array; dimensions depend on the model.
data[].indexintegerIndex position corresponding to the input text (starting from 0).
modelstringThe model ID used for this request.
usageobjectToken usage statistics, including prompt_tokens and total_tokens.

Application Scenarios

Semantic Search
Convert queries and documents into embeddings, then perform semantic-level search via embedding similarity, which is more precise than keyword matching.
Text Clustering
Perform clustering analysis on large volumes of text, automatically discovering implicit topics and patterns, suitable for sentiment analysis and content categorization.
Recommendation Systems
Recommend related articles, products, or services based on content embedding similarity, improving personalized experience.
Anomaly Detection
Identify anomalous content or behavior by calculating the distance between text embeddings and normal samples, detecting deviations from normal patterns.
Chat Completions API
View text generation API documentation
Error Code Reference
View error codes and handling methods
Full Pricing
View pricing for all models