Telnyx OpenAI Embeddings API

OpenAI-compatible embeddings endpoints for generating vector representations of text

OpenAPI Specification

telnyx-openai-embeddings-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  contact:
    email: support@telnyx.com
  description: Telnyx provides global communications and connectivity APIs for developers — including SIP trunking, programmable voice, SMS, MMS, WhatsApp Business Messaging, Call Control, Fax, Wireless (IoT & eSIM), Phone Numbers (DID provisioning & porting), Emergency Services, and Network APIs for private interconnects and edge connectivity. Build, scale, and manage voice, messaging, and data networks with Telnyx's carrier-grade global infrastructure and API-first platform.
  title: Telnyx Access Tokens OpenAI Embeddings API
  version: 2.0.0
  x-endpoint-cost: light
servers:
- description: Version 2.0.0 of the Telnyx API
  url: https://api.telnyx.com/v2
security:
- bearerAuth: []
tags:
- description: OpenAI-compatible embeddings endpoints for generating vector representations of text
  name: OpenAI Embeddings
paths:
  /ai/openai/embeddings:
    post:
      description: Creates an embedding vector representing the input text. This endpoint is compatible with the [OpenAI Embeddings API](https://platform.openai.com/docs/api-reference/embeddings) and may be used with the OpenAI JS or Python SDK by setting the base URL to `https://api.telnyx.com/v2/ai/openai`.
      operationId: create_openai_embeddings
      requestBody:
        content:
          application/json:
            example:
              input: The quick brown fox jumps over the lazy dog
              model: thenlper/gte-large
            schema:
              $ref: '#/components/schemas/OpenAIEmbeddingRequest'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OpenAIEmbeddingResponse'
          description: Successful Response
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
          description: Validation Error
      summary: Create embeddings
      tags:
      - OpenAI Embeddings
      x-latency-category: responsive
  /ai/openai/embeddings/models:
    get:
      description: Returns a list of available embedding models. This endpoint is compatible with the OpenAI Models API format.
      operationId: list_openai_embedding_models
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OpenAIEmbeddingModelsResponse'
          description: Successful Response
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
          description: Validation Error
      summary: List embedding models
      tags:
      - OpenAI Embeddings
      x-latency-category: responsive
components:
  schemas:
    OpenAIEmbeddingRequest:
      properties:
        dimensions:
          description: The number of dimensions the resulting output embeddings should have. Only supported in some models.
          type: integer
        encoding_format:
          default: float
          description: The format to return the embeddings in.
          enum:
          - float
          - base64
          type: string
        input:
          description: Input text to embed. Can be a string or array of strings.
          oneOf:
          - description: A single text string to embed
            type: string
          - description: An array of text strings to embed
            items:
              type: string
            type: array
        model:
          description: ID of the model to use. Use the List embedding models endpoint to see available models.
          example: thenlper/gte-large
          type: string
        user:
          description: A unique identifier representing your end-user for monitoring and abuse detection.
          type: string
      required:
      - input
      - model
      title: OpenAIEmbeddingRequest
      type: object
    OpenAIEmbeddingModelMetadata:
      properties:
        created:
          description: Unix timestamp of when the model was created
          type: integer
        id:
          description: The model identifier
          example: thenlper/gte-large
          type: string
        object:
          default: model
          description: The object type, always 'model'
          type: string
        owned_by:
          description: The organization that owns the model
          example: telnyx
          type: string
      required:
      - id
      - object
      - created
      - owned_by
      title: OpenAIEmbeddingModelMetadata
      type: object
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
            - type: string
            - type: integer
          title: Location
          type: array
        msg:
          title: Message
          type: string
        type:
          title: Error Type
          type: string
      required:
      - loc
      - msg
      - type
      title: ValidationError
      type: object
    OpenAIEmbeddingModelsResponse:
      properties:
        data:
          description: List of available embedding models
          items:
            $ref: '#/components/schemas/OpenAIEmbeddingModelMetadata'
          type: array
        object:
          default: list
          description: The object type, always 'list'
          type: string
      required:
      - object
      - data
      title: OpenAIEmbeddingModelsResponse
      type: object
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          title: Detail
          type: array
      title: HTTPValidationError
      type: object
    OpenAIEmbeddingData:
      properties:
        embedding:
          description: The embedding vector
          items:
            type: number
          type: array
        index:
          description: The index of the embedding in the list of embeddings
          type: integer
        object:
          default: embedding
          description: The object type, always 'embedding'
          type: string
      required:
      - object
      - embedding
      - index
      title: OpenAIEmbeddingData
      type: object
    OpenAIEmbeddingResponse:
      properties:
        data:
          description: List of embedding objects
          items:
            $ref: '#/components/schemas/OpenAIEmbeddingData'
          type: array
        model:
          description: The model used for embedding
          type: string
        object:
          default: list
          description: The object type, always 'list'
          type: string
        usage:
          $ref: '#/components/schemas/OpenAIEmbeddingUsage'
      required:
      - object
      - data
      - model
      - usage
      title: OpenAIEmbeddingResponse
      type: object
    OpenAIEmbeddingUsage:
      properties:
        prompt_tokens:
          description: Number of tokens in the input
          type: integer
        total_tokens:
          description: Total number of tokens used
          type: integer
      required:
      - prompt_tokens
      - total_tokens
      title: OpenAIEmbeddingUsage
      type: object
  securitySchemes:
    bearerAuth:
      scheme: bearer
      type: http
    branded-calling_bearerAuth:
      description: API key passed as a Bearer token in the Authorization header
      scheme: bearer
      type: http
    oauthClientAuth:
      description: OAuth 2.0 authentication for Telnyx API and MCP integrations
      flows:
        authorizationCode:
          authorizationUrl: https://api.telnyx.com/v2/oauth/authorize
          refreshUrl: https://api.telnyx.com/v2/oauth/token
          scopes:
            admin: Administrative access to Telnyx resources
          tokenUrl: https://api.telnyx.com/v2/oauth/token
        clientCredentials:
          scopes:
            admin: Administrative access to Telnyx resources
          tokenUrl: https://api.telnyx.com/v2/oauth/token
      type: oauth2
    outbound-voice-profiles_bearerAuth:
      bearerFormat: JWT
      scheme: bearer
      type: http
    pronunciation-dicts_bearerAuth:
      description: Telnyx API v2 key. Obtain from https://portal.telnyx.com
      scheme: bearer
      type: http
    stored-payment-transactions_bearerAuth:
      bearerFormat: JWT
      scheme: bearer
      type: http