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

# 创建嵌入请求

> Converts input content into embedding vectors. Supports text, image URL/base64, and mixed lists.



## OpenAPI

````yaml post /embeddings
openapi: 3.0.0
info:
  title: SiliconFlow API
  description: The SiliconFlow REST API
  version: 1.0.0
  contact:
    name: SiliconFlow Support
    url: https://www.siliconflow.cn/
  license:
    name: MIT
    url: https://github.com/siliconflow/siliconcloud/blob/main/LICENSE
servers:
  - url: https://api.siliconflow.cn/v1
security:
  - bearerAuth: []
paths:
  /embeddings:
    post:
      tags:
        - Embeddings
      summary: Create Embeddings
      description: >-
        Converts input content into embedding vectors. Supports text, image
        URL/base64, and mixed lists.
      operationId: createEmbedding
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EmbeddingsRequest'
      responses:
        '200':
          description: >-
            The response from the model. The response header contains the
            x-siliconcloud-trace-id field, which serves as a unique identifier
            for tracing requests, facilitating log queries and issue
            troubleshooting.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EmbeddingsResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/RateLimit'
        '503':
          $ref: '#/components/responses/Overloaded'
        '504':
          $ref: '#/components/responses/Timeout'
      deprecated: false
      x-codeSamples:
        - lang: curl
          label: Single text string
          source: |
            curl -X POST https://api.siliconflow.cn/v1/embeddings \
              -H "Authorization: Bearer $SILICONFLOW_API_KEY" \
              -H "Content-Type: application/json" \
              -d '{
                "input": "Hello, world!",
                "model": "Qwen/Qwen3-VL-Embedding-8B"
              }'
        - lang: curl
          label: Text content object
          source: |
            curl -X POST https://api.siliconflow.cn/v1/embeddings \
              -H "Authorization: Bearer $SILICONFLOW_API_KEY" \
              -H "Content-Type: application/json" \
              -d '{
                "input": {
                  "text": "The quick brown fox"
                },
                "model": "Qwen/Qwen3-VL-Embedding-8B",
                "encoding_format": "float"
              }'
        - lang: curl
          label: Image content
          source: |
            curl -X POST https://api.siliconflow.cn/v1/embeddings \
              -H "Authorization: Bearer $SILICONFLOW_API_KEY" \
              -H "Content-Type: application/json" \
              -d '{
                "input": {
                  "image": "https://example.com/image.jpg"
                },
                "model": "Qwen/Qwen3-VL-Embedding-8B"
              }'
        - lang: curl
          label: Mixed content list
          source: |
            curl -X POST https://api.siliconflow.cn/v1/embeddings \
              -H "Authorization: Bearer $SILICONFLOW_API_KEY" \
              -H "Content-Type: application/json" \
              -d '{
                "input": [
                  "First text",
                  {
                    "text": "Second text"
                  },
                  {
                    "image": "https://example.com/image.jpg"
                  }
                ],
                "model": "Qwen/Qwen3-VL-Embedding-8B",
                "dimensions": 768
              }'
        - lang: curl
          label: Long text handling
          source: |
            curl -X POST https://api.siliconflow.cn/v1/embeddings \
              -H "Authorization: Bearer $SILICONFLOW_API_KEY" \
              -H "Content-Type: application/json" \
              -d '{
                "input": "Very long text content...",
                "model": "Qwen/Qwen3-VL-Embedding-8B",
                "truncate": "right",
                "user": "user_123"
              }'
components:
  schemas:
    EmbeddingsRequest:
      description: >
        Compatible with two request formats:

        - Classic Embedding: keeps the historical parameter definition

        - VL Embedding: supports mixed text/image input, plus `user` and
        `truncate`


        Note: OpenAPI cannot automatically route schemas based on `model`.
        Choose parameters according to model capabilities.
      anyOf:
        - $ref: '#/components/schemas/EmbeddingsClassicRequest'
        - $ref: '#/components/schemas/EmbeddingsVLRequest'
    EmbeddingsResponse:
      type: object
      required:
        - object
        - model
        - data
        - usage
      properties:
        object:
          type: string
          description: The object type, which is always "list".
          enum:
            - - list
        model:
          description: The name of the model used to generate the embedding.
          type: string
        data:
          type: array
          description: The list of embeddings generated by the model.
          items:
            type: object
            required:
              - index
              - object
              - embedding
            properties:
              object:
                type: string
                enum:
                  - embedding
              embedding:
                type: array
                items:
                  type: number
              index:
                type: integer
        usage:
          type: object
          description: The usage information for the request.
          properties:
            prompt_tokens:
              type: integer
              description: The number of tokens used by the prompt.
            completion_tokens:
              type: integer
              description: The number of tokens used by the completion.
            total_tokens:
              type: integer
              description: The total number of tokens used by the request.
          required:
            - prompt_tokens
            - total_tokens
            - completion_tokens
    EmbeddingsClassicRequest:
      title: EmbeddingsClassicRequest
      type: object
      required:
        - model
        - input
      properties:
        model:
          type: string
          description: >-
            Corresponding Model Name. To better enhance service quality, we will
            make periodic changes to the models provided by this service,
            including but not limited to model on/offlining and adjustments to
            model service capabilities. We will notify you of such changes
            through appropriate means such as announcements or message pushes
            where feasible.  **For a complete list of available models, please
            check the
            [Models](https://cloud.siliconflow.cn/sft-d29cs9gh3vvc73c59kb0/models?types=embedding)**.
          example: BAAI/bge-large-zh-v1.5
        input:
          description: >
            Input text to embed must be provided as a string or an array of
            tokens. To process multiple inputs in a single request, pass an
            array of strings or an array of token arrays. The input length must
            not exceed the model's maximum token limit and should not be an
            empty string.

            The maximum input tokens for each model are as follows:


            BAAI/bge-large-zh-v1.5, BAAI/bge-large-en-v1.5,
            netease-youdao/bce-embedding-base_v1: 512

            BAAI/bge-m3, Pro/BAAI/bge-m3: 8192

            Qwen/Qwen3-Embedding-8B, Qwen/Qwen3-Embedding-4B,
            Qwen/Qwen3-Embedding-0.6B: 32768
          oneOf:
            - type: string
              title: string
              description: >-
                The string that will be turned into an embedding. the item must
                not exceed the max models tokens limitation.
              example: >-
                Silicon flow embedding online: fast, affordable, and
                high-quality embedding services. come try it out!
            - type: array
              title: array
              description: >
                The array of strings that will be turned into an embedding. The
                array length must not exceed the max size, and the item must not
                exceed the max models tokens limitation.

                Current, the maximum array size is 32 , At the same time every
                item must not exceed 512 tokens for current models.
              minItems: 1
              maxItems: 32
              items:
                type: string
                default: '[''LLM'', ''Embedding'', ''RAG'']'
                example: '[''LLM'', ''Embedding'', ''RAG'']'
        encoding_format:
          description: >
            "The format to return the embeddings in. Can be either `float` or
            [`base64`](https://pypi.org/project/pybase64/). "
          example: float
          default: float
          type: string
          enum:
            - float
            - base64
        dimensions:
          description: >
            The number of dimensions the resulting output embeddings should
            have. Only supported in `Qwen/Qwen3` series.  -
            Qwen/Qwen3-Embedding-8B:
            [64,128,256,512,768,1024,1536,2048,2560,4096] - 
            Qwen/Qwen3-Embedding-4B:[64,128,256,512,768,1024,1536,2048,2560] -
            Qwen/Qwen3-Embedding-0.6B: [64,128,256,512,768,1024]
          type: integer
          example: 1024
    EmbeddingsVLRequest:
      title: EmbeddingsVLRequest
      type: object
      required:
        - model
        - input
      properties:
        model:
          type: string
          description: >-
            The model name for VL Embedding. support
            models:Qwen/Qwen3-VL-Embedding-8B.
          example: Qwen/Qwen3-VL-Embedding-8B
        input:
          description: >
            Input content to be converted. Supported forms:

            - A single string

            - A content object (text or image)

            - A mixed list (strings/content objects)


            Notes:

            - Text content object format: `{"text":"text to embed"}`

            - Image content object format:
            `{"image":"https://example.com/image.jpg"}` or base64

            - Video content is not supported yet

            - Input length must not exceed the model context limit and cannot be
            empty
          oneOf:
            - type: string
              title: string
              description: 作为 embedding 输入的单条文本。
              example: >-
                Silicon flow embedding online: fast, affordable, and
                high-quality embedding services. come try it out!
            - $ref: '#/components/schemas/EmbeddingTextContent'
            - $ref: '#/components/schemas/EmbeddingImageContent'
            - type: array
              title: array
              description: >-
                A content list where each item can be a string, text object, or
                image object.
              minItems: 1
              maxItems: 32
              items:
                $ref: '#/components/schemas/EmbeddingInputItem'
              example:
                - First text
                - text: Second text
                - image: https://example.com/image.jpg
        encoding_format:
          description: |
            Output encoding format. Available values: `float` or `base64`.
          example: float
          default: float
          type: string
          enum:
            - float
            - base64
        dimensions:
          description: >
            The number of dimensions the resulting output embeddings should
            have. Only supported in `Qwen/Qwen3` series.  -
            Qwen/Qwen3-Embedding-8B:
            [64,128,256,512,768,1024,1536,2048,2560,4096] - 
            Qwen/Qwen3-Embedding-4B:[64,128,256,512,768,1024,1536,2048,2560] -
            Qwen/Qwen3-Embedding-0.6B: [64,128,256,512,768,1024]
          type: integer
          example: 1024
        user:
          type: string
          description: User identifier for request tracing and rate limiting.
          example: user_123
        truncate:
          type: string
          description: >-
            Truncation direction for overlong text. Available values: `left` or
            `right`.
          enum:
            - left
            - right
          example: right
    BadRquestData:
      type: object
      required:
        - message
        - data
        - code
      properties:
        code:
          type: integer
          nullable: true
          default: false
          example: 20012
        message:
          type: string
          nullable: false
        data:
          type: string
          nullable: false
    UnauthorizedData:
      type: string
      default: false
      example: Invalid token
    ForbiddenData:
      type: string
      default: false
      example: Forbidden
    NotFoundData:
      type: string
      default: false
      example: 404 page not found
    RateLimitData:
      type: object
      required:
        - message
        - data
      properties:
        message:
          type: string
          example: >-
            Request was rejected due to rate limiting. If you want more, please
            contact contact@siliconflow.cn. Details:TPM limit reached.
        data:
          type: string
    OverloadedtData:
      type: object
      required:
        - code
        - message
        - data
      properties:
        code:
          type: integer
          example: 50505
        message:
          type: string
          example: Model service overloaded. Please try again later.
        data:
          type: string
          nullable: false
    TimeoutData:
      type: string
    EmbeddingTextContent:
      type: object
      description: Text content object.
      properties:
        text:
          type: string
          description: Text content to be converted.
          example: The quick brown fox
      required:
        - text
    EmbeddingImageContent:
      type: object
      description: Image content object.
      properties:
        image:
          type: string
          description: Image URL or base64-encoded image content.
          example: https://example.com/image.jpg
      required:
        - image
    EmbeddingInputItem:
      description: A single item in the embedding input list.
      oneOf:
        - type: string
          description: Text string.
          example: First text
        - $ref: '#/components/schemas/EmbeddingTextContent'
        - $ref: '#/components/schemas/EmbeddingImageContent'
  responses:
    BadRequest:
      description: BadRequest
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/BadRquestData'
    Unauthorized:
      description: Unauthorized
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/UnauthorizedData'
    Forbidden:
      description: Forbidden
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ForbiddenData'
    NotFound:
      description: NotFound
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/NotFoundData'
    RateLimit:
      description: RateLimit
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/RateLimitData'
    Overloaded:
      description: Overloaded
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/OverloadedtData'
    Timeout:
      description: Timeout
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/TimeoutData'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: your api key
      description: >-
        Use the following format for authentication: Bearer [<your api
        key>](https://cloud.siliconflow.cn/account/ak)

````