{
  "components": {
    "securitySchemes": {
      "BearerAuth": {
        "bearerFormat": "API Key",
        "scheme": "bearer",
        "type": "http"
      }
    }
  },
  "info": {
    "description": "通过 AIsa 中继（OpenAI 兼容）路径提供的 Jina embedding 和重排序服务。包含文本 embedding（jina-embeddings-v3 和 jina-embeddings-v5-text-small，输出均为 1024 维）以及文档重排序（jina-reranker-v3）。两个 endpoint 均按 token 计费。",
    "title": "Jina Embeddings & Rerank API",
    "version": "1.0.0"
  },
  "openapi": "3.0.3",
  "paths": {
    "/embeddings": {
      "post": {
        "description": "使用 jina-embeddings-v3 或 jina-embeddings-v5-text-small（输出均为 1024 维）为一个或多个输入字符串生成 embedding 向量。请求和响应均为 OpenAI 兼容。通过 AIsa 中继路径 /v1/embeddings 提供服务。按 token 计费。",
        "operationId": "createEmbedding",
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "input": "A fast, OpenAI-compatible embeddings endpoint.",
                "model": "jina-embeddings-v3"
              },
              "schema": {
                "properties": {
                  "input": {
                    "description": "要做 embedding 的非空字符串，或非空字符串数组。",
                    "example": "A fast, OpenAI-compatible embeddings endpoint.",
                    "oneOf": [
                      {
                        "type": "string"
                      },
                      {
                        "items": {
                          "type": "string"
                        },
                        "minItems": 1,
                        "type": "array"
                      }
                    ]
                  },
                  "model": {
                    "description": "Embedding 模型名称。可选：jina-embeddings-v3 或 jina-embeddings-v5-text-small（输出均为 1024 维）。",
                    "enum": [
                      "jina-embeddings-v3",
                      "jina-embeddings-v5-text-small"
                    ],
                    "example": "jina-embeddings-v3",
                    "type": "string"
                  }
                },
                "required": [
                  "model",
                  "input"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "example": {
                  "data": [
                    {
                      "embedding": [
                        0.0123,
                        -0.0456,
                        0.0789
                      ],
                      "index": 0,
                      "object": "embedding"
                    }
                  ],
                  "model": "jina-embeddings-v3",
                  "object": "list",
                  "usage": {
                    "total_tokens": 9
                  }
                },
                "schema": {
                  "properties": {
                    "data": {
                      "items": {
                        "properties": {
                          "embedding": {
                            "description": "1024 维 embedding 向量。",
                            "items": {
                              "format": "float",
                              "type": "number"
                            },
                            "type": "array"
                          },
                          "index": {
                            "example": 0,
                            "type": "integer"
                          },
                          "object": {
                            "example": "embedding",
                            "type": "string"
                          }
                        },
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "model": {
                      "example": "jina-embeddings-v3",
                      "type": "string"
                    },
                    "object": {
                      "example": "list",
                      "type": "string"
                    },
                    "usage": {
                      "properties": {
                        "total_tokens": {
                          "example": 9,
                          "type": "integer"
                        }
                      },
                      "type": "object"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Embedding 列表。"
          }
        },
        "summary": "创建 embeddings"
      }
    },
    "/rerank": {
      "post": {
        "description": "使用 jina-reranker-v3 针对某个 query 对文档列表重排序，返回按相关性分数排序的文档。通过 AIsa 中继路径 /v1/rerank 提供服务。按 token 计费。",
        "operationId": "createRerank",
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "documents": [
                  "Paris is the capital of France.",
                  "Berlin is the capital of Germany.",
                  "The Eiffel Tower is in Paris."
                ],
                "model": "jina-reranker-v3",
                "query": "What is the capital of France?",
                "top_n": 2
              },
              "schema": {
                "properties": {
                  "documents": {
                    "description": "要重排序的非空文档字符串数组。",
                    "example": [
                      "Paris is the capital of France.",
                      "Berlin is the capital of Germany.",
                      "The Eiffel Tower is in Paris."
                    ],
                    "items": {
                      "type": "string"
                    },
                    "minItems": 1,
                    "type": "array"
                  },
                  "model": {
                    "description": "重排序模型名称。",
                    "example": "jina-reranker-v3",
                    "type": "string"
                  },
                  "query": {
                    "description": "用于对文档排序的非空查询字符串。",
                    "example": "What is the capital of France?",
                    "type": "string"
                  },
                  "top_n": {
                    "description": "可选。只返回相关性最高的前 N 个文档。",
                    "example": 2,
                    "type": "integer"
                  }
                },
                "required": [
                  "model",
                  "query",
                  "documents"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "example": {
                  "model": "jina-reranker-v3",
                  "results": [
                    {
                      "document": {
                        "text": "Paris is the capital of France."
                      },
                      "index": 0,
                      "relevance_score": 0.98
                    },
                    {
                      "document": {
                        "text": "The Eiffel Tower is in Paris."
                      },
                      "index": 2,
                      "relevance_score": 0.71
                    }
                  ],
                  "usage": {
                    "total_tokens": 27
                  }
                },
                "schema": {
                  "properties": {
                    "model": {
                      "example": "jina-reranker-v3",
                      "type": "string"
                    },
                    "results": {
                      "items": {
                        "properties": {
                          "document": {
                            "properties": {
                              "text": {
                                "example": "Paris is the capital of France.",
                                "type": "string"
                              }
                            },
                            "type": "object"
                          },
                          "index": {
                            "description": "该文档在原始请求数组中的索引。",
                            "example": 0,
                            "type": "integer"
                          },
                          "relevance_score": {
                            "example": 0.98,
                            "format": "float",
                            "type": "number"
                          }
                        },
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "usage": {
                      "properties": {
                        "total_tokens": {
                          "example": 27,
                          "type": "integer"
                        }
                      },
                      "type": "object"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "按相关性排序的重排序结果。"
          }
        },
        "summary": "重排序文档"
      }
    }
  },
  "security": [
    {
      "BearerAuth": []
    }
  ],
  "servers": [
    {
      "url": "https://api.aisa.one/v1"
    }
  ],
  "tags": [
    {
      "name": "Embeddings & Rerank"
    }
  ]
}
