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

# Dedicated Embeddings

> Generate an embedding vector from input text or token sequence.

Generate an embedding vector from input text or token sequence.

To request successfully, it is mandatory to enter a **Personal API Key** (e.g. flp\_XXX) value in the **Bearer Token** field.
Refer to the [authentication section](/openapi/introduction#authentication) on our introduction page to learn how to acquire this variable and [visit here](https://friendli.ai/suite/~/setting/keys) to generate your API Key.


## OpenAPI

````yaml https://github.com/friendliai/friendli-openapi/raw/refs/heads/main/openapi.yaml post /dedicated/v1/embeddings
openapi: 3.1.0
info:
  title: Friendli Suite API Reference
  description: This is an OpenAPI reference of Friendli Suite API.
  termsOfService: https://friendli.ai/terms-of-service
  contact:
    name: FriendliAI Support Team
    email: support@friendli.ai
  version: 0.1.0
servers:
  - url: https://api.friendli.ai
security: []
tags:
  - name: Serverless.Chat
  - name: Serverless.ToolAssistedChat
  - name: Serverless.Responses
  - name: Serverless.Messages
  - name: Serverless.ChatRender
  - name: Serverless.Completions
  - name: Serverless.Token
  - name: Serverless.Audio
  - name: Serverless.Model
  - name: Serverless.Knowledge
  - name: Dedicated.Chat
  - name: Dedicated.Responses
  - name: Dedicated.Messages
  - name: Dedicated.ChatRender
  - name: Dedicated.Completions
  - name: Dedicated.Embeddings
  - name: Dedicated.TextClassification
  - name: Dedicated.Token
  - name: Dedicated.Image
  - name: Dedicated.Audio
  - name: Dedicated.Endpoint
  - name: Container.Chat
  - name: Container.Responses
  - name: Container.Messages
  - name: Container.Completions
  - name: Container.TextClassification
  - name: Container.Token
  - name: Container.Image
  - name: Container.Audio
  - name: Cost
  - name: Usage
  - name: Dataset
  - name: File
paths:
  /dedicated/v1/embeddings:
    post:
      tags:
        - Dedicated.Embeddings
      summary: Embeddings
      description: Generate an embedding vector from input text or token sequence.
      operationId: dedicatedEmbeddings
      parameters:
        - name: X-Friendli-Team
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: ID of team to run requests as (optional parameter).
            title: X-Friendli-Team
          description: ID of team to run requests as (optional parameter).
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DedicatedEmbeddingsBody'
      responses:
        '200':
          description: Successfully generated embeddings.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DedicatedEmbeddingsSuccess'
              examples:
                Example:
                  value:
                    id: embd-26a1e10db1311bc2adb488d2d205288b
                    model: (endpoint-id)
                    object: list
                    data:
                      - index: 0
                        object: embedding
                        embedding:
                          - 0.0023064255
                          - -0.009327292
                          - -0.0028842222
                    usage:
                      prompt_tokens: 26
                      completion_tokens: 0
                      total_tokens: 26
                    created: 1735722153
        '422':
          description: Unprocessable Entity
      security:
        - token: []
components:
  schemas:
    DedicatedEmbeddingsBody:
      properties:
        model:
          type: string
          title: Model
          description: >-
            ID of target endpoint. If you want to send request to specific
            adapter, use the format "YOUR_ENDPOINT_ID:YOUR_ADAPTER_ROUTE".
            Otherwise, you can just use "YOUR_ENDPOINT_ID" alone.
          examples:
            - (endpoint-id)
        input:
          anyOf:
            - type: string
            - items:
                type: string
              type: array
            - type: 'null'
          title: Input
          description: >-
            Input text to embed, encoded as a string or array of tokens. To
            embed multiple inputs in a single request, pass an array of strings
            or array of token arrays.


            Either `input` or `tokens` field is required.
          examples:
            - The food was delicious and the waiter...
        tokens:
          anyOf:
            - items:
                type: integer
              type: array
            - type: 'null'
          title: Tokens
          description: |-
            The tokenized prompt (i.e., input tokens).

            Either `input` or `tokens` field is required.
        encoding_format:
          anyOf:
            - type: string
              enum:
                - float
                - base64
            - type: 'null'
          title: Encoding Format
          description: >-
            The format to return the embeddings in. Can be either `float` or
            [`base64`](https://pypi.org/project/pybase64/).
          default: float
      type: object
      required:
        - model
      title: DedicatedEmbeddingsBody
      example:
        encoding_format: float
        input: The food was delicious and the waiter...
        model: (endpoint-id)
    DedicatedEmbeddingsSuccess:
      properties:
        id:
          type: string
          title: Id
          description: A unique ID of the embeddings.
        model:
          anyOf:
            - type: string
            - type: 'null'
          title: Model
          description: >-
            The model to generate the embeddings. For dedicated endpoints, it
            returns the endpoint ID.
        object:
          type: string
          const: list
          title: Object
          description: The object type, which is always set to `list`.
        data:
          items:
            $ref: '#/components/schemas/EmbeddingObject'
          type: array
          title: Data
          description: A list of embedding objects.
        usage:
          $ref: '#/components/schemas/TextUsage'
        created:
          type: integer
          title: Created
          description: >-
            The Unix timestamp (in seconds) for when the embeddings were
            created.
      type: object
      required:
        - id
        - object
        - data
        - usage
        - created
      title: DedicatedEmbeddingsSuccess
    EmbeddingObject:
      properties:
        index:
          type: integer
          title: Index
          description: The index of the embedding in the list of embeddings.
        object:
          type: string
          const: embedding
          title: Object
          description: The object type, which is always set to `embedding`.
        embedding:
          anyOf:
            - items:
                type: number
              type: array
            - type: string
              format: binary
          title: Embedding
          description: >-
            The embedding vector, which is a list of floats or a base64-encoded
            string. The length of vector depends on the model.
      type: object
      required:
        - index
        - object
        - embedding
      title: EmbeddingObject
    TextUsage:
      properties:
        prompt_tokens:
          type: integer
          title: Prompt Tokens
          description: Number of tokens in the prompt.
          examples:
            - 5
        completion_tokens:
          type: integer
          title: Completion Tokens
          description: Number of tokens in the generated completions.
          examples:
            - 7
        total_tokens:
          type: integer
          title: Total Tokens
          description: >-
            Total number of tokens used in the request (`prompt_tokens` +
            `completion_tokens`).
          examples:
            - 12
        prompt_tokens_details:
          anyOf:
            - $ref: '#/components/schemas/PromptTokensDetails'
            - type: 'null'
          description: Breakdown of tokens used in the prompt.
      type: object
      required:
        - prompt_tokens
        - completion_tokens
        - total_tokens
      title: TextUsage
    PromptTokensDetails:
      properties:
        cached_tokens:
          anyOf:
            - type: integer
            - type: 'null'
          title: Cached Tokens
          description: Cached tokens present in the prompt.
      type: object
      title: PromptTokensDetails
  securitySchemes:
    token:
      type: http
      description: >-
        When using Friendli Suite API for inference requests, you need to
        provide a **Friendli Token** for authentication and authorization
        purposes.


        For more detailed information, please refer
        [here](https://friendli.ai/docs/openapi/introduction#authentication).
      scheme: bearer

````