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

# Create embeddings

> Generate vector embeddings for input text. **Note:** This endpoint requires an embedding model to be available. Check `GET /v1/models` for current model availability.



## OpenAPI

````yaml /en/api-reference/openapi_infercom.yml post /embeddings
openapi: 3.1.1
info:
  title: Infercom Inference Service API
  description: Infercom Inference Service API Specification
  version: 1.0.0
  termsOfService: https://infercom.ai/terms-of-service
  contact:
    email: support@infercom.ai
    name: Infercom Support
  license:
    name: Apache 2.0
    url: https://www.apache.org/licenses/LICENSE-2.0.html
servers:
  - url: https://api.infercom.ai/v1
security:
  - api_key: []
externalDocs:
  description: Find out more in the official Infercom docs
  url: /en/api-reference/overview
paths:
  /embeddings:
    post:
      tags:
        - Embeddings
      summary: Create embeddings
      description: >-
        Generate vector embeddings for input text. **Note:** This endpoint
        requires an embedding model to be available. Check `GET /v1/models` for
        current model availability.
      operationId: createEmbedding
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EmbeddingsRequest'
        description: Texts to embed and parameters
        required: true
      responses:
        '200':
          description: Successful response
          headers:
            inference-id:
              $ref: '#/components/headers/InferenceId'
            x-ratelimit-limit-requests:
              $ref: '#/components/headers/RateLimitRequests'
            x-ratelimit-limit-requests-day:
              $ref: '#/components/headers/RateLimitRequestsDay'
            x-ratelimit-remaining-requests:
              $ref: '#/components/headers/RateLimitRemainingRequests'
            x-ratelimit-remaining-requests-day:
              $ref: '#/components/headers/RateLimitRemainingRequestsDay'
            x-ratelimit-reset-requests:
              $ref: '#/components/headers/RateLimitResetRequests'
            x-ratelimit-reset-requests-day:
              $ref: '#/components/headers/RateLimitResetRequestsDay'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EmbeddingsResponse'
        '400':
          description: Bad Request - Missing or invalid parameters
          content:
            text/plain:
              schema:
                type: string
                example: 'Invalid request body:  - missing property ''model''"'
            application/json:
              schema:
                $ref: '#/components/schemas/SimpleError'
              example:
                error: Model name is required
        '401':
          description: Unauthorized access
          content:
            text/plain:
              schema:
                type: string
                example: unauthorized
        '404':
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SimpleError'
        '408':
          description: Request timeout
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SimpleError'
        '410':
          description: Gone - model is no longer available (deprecated or removed)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SimpleError'
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GeneralError'
        '500':
          description: Internal Server Error. Unexpected issue on server side.
          content:
            text/plain:
              schema:
                type: string
        '503':
          description: Service Temporarily Unavailable
          content:
            text/plain:
              schema:
                type: string
                example: Service Temporarily Unavailable
      security:
        - api_key: []
      x-codeSamples:
        - lang: Python
          source: |-
            from openai import OpenAI

            client = OpenAI(
                base_url="https://api.infercom.ai/v1",
                api_key="your-infercom-api-key",
            )

            response = client.embeddings.create(
                input=["text to embed"],
                model="E5-Mistral-7B-Instruct",
            )

            print(response.data[0].embedding)
        - lang: cURL
          source: |-
            curl -X POST https://api.infercom.ai/v1/embeddings \
              -H "Authorization: Bearer $INFERCOM_API_KEY" \
              -H "Content-Type: application/json" \
              -d '{
                "input": ["text to embed"],
                "model": "E5-Mistral-7B-Instruct"
              }'
components:
  schemas:
    EmbeddingsRequest:
      title: Embeddings Request
      type: object
      description: embeddings request object
      additionalProperties: true
      properties:
        model:
          title: Model
          description: >-
            The model ID to use See available
            [models](/en/models/infercomcloud-models)
          anyOf:
            - type: string
            - enum:
                - E5-Mistral-7B-Instruct
        input:
          title: input
          description: >-
            Input text to embed. to embed multiple inputs in a single request, 
            pass an array of strings. The input must not exceed the max input
            tokens for the model
          oneOf:
            - type: string
              description: The string that will be turned into an embedding.
            - type: array
              description: The array of strings that will be turned into an embeddings.
              minItems: 1
              items:
                type: string
      required:
        - model
        - input
      example:
        input:
          - text to embed number 1
          - text to embed number 2
        model: E5-Mistral-7B-Instruct
    EmbeddingsResponse:
      title: Embeddings Response
      type: object
      description: Embeddings response returned by the model
      properties:
        object:
          title: object
          type: string
          description: The object type, which is always "list".
          enum:
            - list
        model:
          type: string
          description: The name of the model used to generate the embedding.
        usage:
          $ref: '#/components/schemas/Usage'
        data:
          type: array
          description: The list of embeddings generated by the model.
          items:
            $ref: '#/components/schemas/Embedding'
      required:
        - object
        - model
        - usage
        - data
      example:
        data:
          - index: 0
            object: embedding
            embedding:
              - 0.024864232167601585
              - -0.01452154759317636
              - 0.008880083449184895
          - index: 1
            object: embedding
            embedding:
              - 0.010919672437012196
              - 0.0016351072117686272
              - 0.008019134402275085
        model: E5-Mistral-7B-Instruct
        object: list
        usage:
          prompt_tokens: 716
          total_tokens: 716
    SimpleError:
      title: SimpleError
      type: object
      description: other kind of simple schema errors
      properties:
        error:
          title: error
          type: string
          description: error detail.
          nullable: true
      required:
        - error
    GeneralError:
      title: GeneralError
      type: object
      description: other kind of errors
      properties:
        error:
          type: object
          properties:
            code:
              title: code
              type: string
              description: error code
              nullable: true
            message:
              title: message
              type: string
              description: error message
            param:
              title: param
              type: string
              description: error params
              nullable: true
            type:
              title: type
              type: string
              description: error type
      required:
        - error
    Usage:
      title: Usage
      type: object
      description: >-
        Usage metrics for the completion, embeddings,transcription or
        translation request
      additionalProperties: true
      properties:
        acceptance_rate:
          title: Acceptance Rate
          type: number
          description: acceptance rate
        completion_tokens:
          title: Completion Tokens
          type: integer
          description: number of tokens generated in completion
        completion_tokens_after_first_per_sec:
          title: Completion Tokens After First Per Sec
          type: number
          description: completion tokens per second after first token generation
        completion_tokens_after_first_per_sec_first_ten:
          title: Completion Tokens After First Per Sec First Ten
          type: number
          description: completion tokens per second after first token generation first ten
        completion_tokens_after_first_per_sec_graph:
          title: Completion Tokens After First Per Sec Graph
          type: number
          description: completion tokens per second after first token generation
        completion_tokens_per_sec:
          title: Completion Tokens Per Sec
          type: number
          description: completion tokens per second
        end_time:
          title: End Time
          type: number
          description: The Unix timestamp (in seconds) of when the generation finished.
        is_last_response:
          title: Is Last Response
          type: boolean
          description: >-
            whether or not is last response, always true for non streaming
            response
          const: true
        prompt_tokens_details:
          title: Prompt tokens details
          type: object
          description: Extra tokens details
          additionalProperties: true
          properties:
            cached_tokens:
              title: Cached tokens
              description: amount of cached tokens
              type: integer
        prompt_tokens:
          title: Prompt Tokens
          type: integer
          description: number of tokens used in the prompt sent
        start_time:
          title: Start Time
          type: number
          description: The Unix timestamp (in seconds) of when the generation started.
        time_to_first_token:
          title: Time To First Token
          type: number
          description: also TTF, time (in seconds) taken to generate the first token
        time_to_first_token_graph:
          title: Time To First Token Graph
          type: number
          description: time to first token measurement for graphing/monitoring purposes
        stop_reason:
          title: Stop Reason
          type: string
          description: >-
            The reason generation stopped. Values include `stop` (natural end or
            stop sequence), `length` (max_tokens reached), `tool_calls` (model
            invoked a tool).
          nullable: true
        total_latency:
          title: Total Latency
          type: number
          description: total time (in seconds) taken to generate the full generation
        total_tokens:
          title: Total Tokens
          type: integer
          description: prompt tokens + completion tokens
        total_tokens_per_sec:
          title: Total Tokens Per Sec
          type: number
          description: tokens per second including prompt and completion
      nullable: true
      examples:
        - acceptance_rate: 4.058139324188232
          completion_tokens: 350
          completion_tokens_after_first_per_sec: 248.09314856382406
          completion_tokens_after_first_per_sec_first_ten: 249.67922929952655
          completion_tokens_after_first_per_sec_graph: 452.5030493415834
          completion_tokens_per_sec: 238.91966176995348
          end_time: 1737583289.7345645
          is_last_response: true
          prompt_tokens_details:
            cached_tokens: 0
          prompt_tokens: 43
          start_time: 1737583288.264706
          time_to_first_token: 0.06312894821166992
          total_latency: 1.4649275719174653
          total_tokens: 393
          total_tokens_per_sec: 268.27264878740493
        - prompt_tokens: 43
          total_tokens: 393
    Embedding:
      type: object
      title: Embedding
      description: Represents an embedding vector returned by embeddings endpoint.
      properties:
        index:
          type: integer
          title: index
          description: The index of the embedding in the list of embeddings.
        object:
          type: string
          title: object
          description: Object type, always embedding.
          enum:
            - embedding
        embedding:
          type: array
          items:
            type: number
          title: embedding
          description: List of floats containing the embedding vector.
          nullable: true
      required:
        - index
        - object
        - embedding
  headers:
    InferenceId:
      description: >-
        Unique identifier for this inference request, useful for debugging and
        support.
      schema:
        type: string
        example: a0b08d8a-1893-45d6-a0f4-7ad6fdeb5443
    RateLimitRequests:
      description: Maximum requests allowed per minute.
      schema:
        type: integer
        example: 250
    RateLimitRequestsDay:
      description: Maximum requests allowed per day.
      schema:
        type: integer
        example: 50000
    RateLimitRemainingRequests:
      description: Remaining requests in the current minute window.
      schema:
        type: integer
        example: 247
    RateLimitRemainingRequestsDay:
      description: Remaining requests in the current day.
      schema:
        type: integer
        example: 49988
    RateLimitResetRequests:
      description: Unix timestamp when the per-minute limit resets.
      schema:
        type: integer
        example: 1776937132
    RateLimitResetRequestsDay:
      description: Unix timestamp when the daily limit resets.
      schema:
        type: integer
        example: 1777023472
  securitySchemes:
    api_key:
      type: http
      description: Infercom API Key
      scheme: bearer
      bearerFormat: apiKey

````