Skip to content

Text Embedding

1. Get Model List API

GET /v1/models

Get the list of all currently available models and their status information.

Response (200)

json
{
  "data": [
    {
      "id": "Qwen2-Embedding-48",
      "stats": {
        "queue_fraction": 0,
        "queue_absolute": 0,
        "results_pending": 1,
        "batch_size": 32
      },
      "object": "model",
      "owned_by": "infinity",
      "created": 1750989144,
      "backend": "torch",
      "capabilities": ["embed"]
    }
  ],
  "object": "list"
}

Description of Response Parameters

  • object: The response object type is fixed as "list".
  • data: Model array, containing information about all available models
    • id: Model Unique Identifier
    • object: The model object type is fixed as "model"
    • owned_by: Model Provider
    • created: Model Creation Timestamp
    • backend: Model Backend Framework (e.g., "torch")
    • capabilities: List of functions supported by the model (e.g., ["embed"] indicates support for the embedding function)
    • stats: Statistics on the Current Operational Status of the Model
      • queue_fraction: Queue Occupancy Rate
      • queue_absolute: Absolute Queue Quantity
      • results_pending: Number of Pending Results
      • batch_size: Batch Size

Response Header

Content-Type: application/json
Content-Length: 243
Date: Fri, 27 Jun 2025 01:52:24 GMT
Server: uvicorn

2. Embedding API

POST /v1/embeddings

Create an embedding vector that represents the input text.

Request Body

json
{
  "model": "text-embedding-3-large",
  "input": "This is the text that needs to be embedded.",
  "encoding_format": "float",
  "dimensions": 1536
}

Parameter Description

  • model(Required):The model ID to be used, e.g., "text-embedding-3-large"
  • input(Required):The input text to be embedded, which can be a string or an array of strings
  • encoding_format(Optional):The encoding format of the output vector. Optional values are "float" or "base64", with the default being "float".
  • dimensions(Optional):The dimension of the output vector, applicable only to models that support dimension selection

Response (200)

json
{
  "object": "list",
  "data": [
    {
      "object": "embedding",
      "embedding": [0.0023064255, -0.009327292, ...],
      "index": 0
    }
  ],
  "model": "text-embedding-3-large",
  "usage": {
    "prompt_tokens": 8,
    "total_tokens": 8
  }
}