{
  "openapi": "3.1.0",
  "info": {
    "title": "Text Embeddings API",
    "version": "1.0.0",
    "description": "768-dimensional text embeddings for semantic search, clustering and RAG, from an on-platform model.\n\nTurn text into 768-dimensional vectors for semantic search, clustering, deduplication and retrieval-augmented generation, with a BGE model that runs on the platform. Embed one string or a batch per call. No third-party keys and nothing leaves the platform.",
    "contact": {
      "name": "Data and APIs",
      "url": "https://dataandapis.com/contact"
    },
    "termsOfService": "https://dataandapis.com/terms-of-service",
    "license": {
      "name": "Data and APIs Terms of Service",
      "url": "https://dataandapis.com/terms-of-service"
    },
    "x-logo": {
      "url": "https://dataandapis.com/images/text-embeddings.webp"
    }
  },
  "externalDocs": {
    "description": "Documentation, live tester and pricing",
    "url": "https://dataandapis.com/apis/text-embeddings"
  },
  "servers": [
    {
      "url": "https://api-embeddings.dataandapis.com"
    }
  ],
  "tags": [
    {
      "name": "AI",
      "description": "Text Embeddings API belongs to the AI category of the Data and APIs catalog."
    }
  ],
  "paths": {
    "/v1/embeddings": {
      "get": {
        "operationId": "embedText",
        "summary": "Embed Text",
        "description": "Embed Text endpoint of the Text Embeddings API. Costs 10 tokens per call.",
        "externalDocs": {
          "url": "https://dataandapis.com/apis/text-embeddings/embed-text"
        },
        "parameters": [
          {
            "name": "text",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "hello world"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "model": "@cf/baai/bge-base-en-v1.5",
                  "dimensions": 768,
                  "count": 1,
                  "embeddings": [
                    [
                      0.0123,
                      -0.0456,
                      0.0789,
                      "...768 floats..."
                    ]
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key"
          },
          "402": {
            "description": "Subscription past due; the response carries a payment_url"
          },
          "429": {
            "description": "Monthly token allowance exhausted"
          }
        },
        "security": [
          {
            "ApiKey": []
          }
        ]
      },
      "post": {
        "operationId": "embedTextPost",
        "summary": "Embed Text (POST)",
        "description": "Embed Text (POST) endpoint of the Text Embeddings API. Costs 10 tokens per call.",
        "externalDocs": {
          "url": "https://dataandapis.com/apis/text-embeddings/embed-text-post"
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              },
              "example": {
                "text": [
                  "the quick brown fox",
                  "a lazy dog"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "model": "@cf/baai/bge-base-en-v1.5",
                  "dimensions": 768,
                  "count": 2,
                  "embeddings": [
                    [
                      -0.037689208984375,
                      -0.073974609375,
                      0.01934814453125,
                      0.04351806640625,
                      "...768 floats..."
                    ],
                    [
                      0.00478363037109375,
                      -0.0276947021484375,
                      -0.003910064697265625,
                      0.031524658203125,
                      "...768 floats..."
                    ]
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key"
          },
          "402": {
            "description": "Subscription past due; the response carries a payment_url"
          },
          "429": {
            "description": "Monthly token allowance exhausted"
          }
        },
        "security": [
          {
            "ApiKey": []
          }
        ]
      }
    }
  },
  "components": {
    "securitySchemes": {
      "ApiKey": {
        "type": "apiKey",
        "in": "header",
        "name": "X-Api-Key",
        "description": "Create a free key at https://dataandapis.com/sign-up. 500 tokens a month on the Free plan; this API costs 10 tokens per call."
      }
    }
  },
  "security": [
    {
      "ApiKey": []
    }
  ]
}