> ## Documentation Index
> Fetch the complete documentation index at: https://docs.phanedge.cloud/llms.txt
> Use this file to discover all available pages before exploring further.

# Embeddings

> 通过 OpenAI 兼容 /v1/embeddings 生成文本向量

`POST /v1/embeddings` 用于把文本转换为向量，适合语义检索、聚类、召回和重排前的候选生成。

## 请求示例

```bash theme={null}
curl -X POST "https://models.phanedge.cloud/v1/embeddings" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "text-embedding-3-small",
    "input": "PhanEdge 支持统一调用多种模型能力"
  }'
```

## 常见用法

* 将知识库文档切片后写入向量数据库。
* 对用户查询生成向量，用于相似内容召回。
* 与模型列表接口结合，按 Token 可用模型动态选择 embedding 模型。

<Tip>
  如果你需要排查调用问题，请记录响应头中的请求 ID，并参考 [请求追踪](/guide/request-id)。
</Tip>


## OpenAPI

````yaml POST /v1/embeddings
openapi: 3.0.3
info:
  title: PhanEdge Core API
  version: '1.0'
  description: >-
    Core OpenAI-compatible and model-family endpoints used by the PhanEdge user
    docs.
servers:
  - url: https://models.phanedge.cloud
security:
  - BearerAuth: []
paths:
  /v1/embeddings:
    post:
      tags:
        - OpenAI
      summary: Embeddings
      requestBody:
        $ref: '#/components/requestBodies/JsonObject'
      responses:
        '200':
          $ref: '#/components/responses/JsonObject'
components:
  requestBodies:
    JsonObject:
      required: true
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/GenericObject'
  responses:
    JsonObject:
      description: OK
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/GenericObject'
  schemas:
    GenericObject:
      type: object
      additionalProperties: true
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: 'Authorization: Bearer <token>'

````