1. Embeddings
AITK-Doc
English
  • 中文
  • English
  • Home Page
  • AITK-API
    • Model
      • Native OpenAI Format
      • Native Gemini Format
    • Chat
      • Native OpenAI Format
      • Native Gemini Format
      • Native Claude Format
      • Responses Request (openai)
    • Audio
      • Native OpenAI Format TTS
      • Native Gemini Format TTS
    • Images
      • Native OpenAI Format Image Editing (JSON)
      • Native OpenAI Format Image Generation
      • Native OpenAI Format Image Editing (Multipart)
      • Native Gemini Format Image Generation
    • Video
      • Seedance2.0 format
        • Create Video Generation Task
        • Query Video Generation Task Status
    • Vector
      • Embeddings
        • Create Embedding
          POST
    • Translation
      • Speech Translation
  • AI application
    • AITK API Integration with Claude Code
    • AITK API Integration with Cursor
    • AITK API Integration with Codex-cli
    • AITK API Integration with Codex Desktop
    • AITK API Integration with Hermes Agent
  1. Embeddings

Create Embedding

POST
/v1/embeddings
📘 API Introduction (Embeddings API)
The Embeddings API is used to convert text into high-dimensional vectors (vector representation), which are widely applied in scenarios such as semantic search, similarity calculation, clustering, and recommendation systems.
This endpoint maps text onto a fixed-dimension floating-point array (vector) to serve as a machine-understandable semantic representation.
🎯 Applicable Scenarios
🔎 Semantic Search
Perform similarity matching between user queries and document vectors (e.g., knowledge base retrieval)
🤖 RAG (Retrieval-Augmented Generation)
Combine with vector databases to achieve context-enhanced Q&A
📊 Text Clustering
Automatically classify text based on semantic similarity
🧠 Recommendation Systems
Execute recommendation ranking based on the semantic similarity of content
🔐 Authentication Method
All requests must be authenticated via a Bearer Token.
Header Example
Authorization: Bearer sk-xxxxxxxxxx
Content-Type: application/json

请求参数

Authorization
Header 参数

Body 参数application/json

示例
{
    "input": "Hello World",
    "model": "text-embedding-3-large",
    "encoding_format": "float",
    "dimensions": 1536,
    "user": "user-1234"
}

请求示例代码

Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
请求示例请求示例
Shell
JavaScript
Java
Swift
curl --location 'https://api.aitk.com/v1/embeddings' \
--header 'Authorization: Bearer {{api_key}}' \
--header 'Content-Type: application/json' \
--data '{
    "input": "Hello World",
    "model": "text-embedding-3-large",
    "encoding_format": "float",
    "dimensions": 1536,
    "user": "user-1234"
}'

返回响应

🟢200
application/json
Successful Response
Bodyapplication/json

示例
{
    "object": "list",
    "data": [
        {
            "object": "embedding",
            "index": 0,
            "embedding": [
                0.0023063174,
                -0.009361042,
                0.015764702,
                -0.007297516,
                0.004337311,
                -0.00058698654,
                0.0006623268,
                0.02305603,
                -0.005214691,
                -0.01725769,
                -0.005870819,
                0.015945435,
                -0.015335083,
                0.0005760193,
                0.025787354,
                0.014816284,
                -0.023544312,
                -0.015090942,
                0.006893158,
                -0.008895874,
                -0.016586304,
                0.0035057068
            ]
        }
    ],
    "model": "text-embedding-3-large",
    "usage": {
        "prompt_tokens": 16,
        "total_tokens": 16
    }
}
修改于 2026-11-23 02:12:04
上一页
Query Video Generation Task Status
下一页
Speech Translation
Built with