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

> ## Agent Instructions
> - Base URLs: models `https://api.aisa.one/v1` (Gemini GenerateContent: `https://api.aisa.one/v1beta`); data APIs `https://api.aisa.one/apis/v1`. The `servers` of each operation in https://aisa.one/openapi.yaml is authoritative.
> - Auth: `Authorization: Bearer $AISA_API_KEY`. Never print, log, or commit the key.
> - MCP (preferred for agents): `https://mcp.aisa.one/mcp`, signed in with OAuth, so there is no key to paste.
> - Agent Skill: `npx skills add AIsa-team/agent-skills --skill aisa`. Fallback with the AIsa CLI: `aisa skills install aisa`.
> - Spending: docs, https://aisa.one/models, https://aisa.one/api, `/v1/models`, and MCP `search`, `list_categories`, `get_details`, `batch_quote`, and the `account` operation are free. Quote the exact calls before running them (MCP `batch_quote`, CLI `aisa quote --json`). If the quote reports `auto_execute_eligible: true`, run it unless the user set a tighter limit or asked only for a quote. Otherwise, tell the user in one message the planned calls, the quoted price, and a total USD budget for the task, then wait for approval. Direct HTTP calls follow the stricter rule at https://aisa.one/docs/get-started/cli.md#direct-http-fallback. Do not make paid calls to test availability. Full rule: https://aisa.one/llms.txt

# 创建 Embeddings

> 使用 Jina embeddings 从文本生成 embedding 向量，通过 OpenAI 兼容的 AIsa API 提供服务。

为一个或多个输入字符串生成 embedding 向量。传入非空的 `input` 字符串，或传入字符串数组做批量 embedding。请求和响应均为 OpenAI 兼容，因此只要把 `base_url` 指向 AIsa API，OpenAI SDK 无需修改即可使用。

**可用模型**（输出均为 1024 维）：

* `jina-embeddings-v3`
* `jina-embeddings-v5-text-small`

通过 AIsa API 路径 `/v1/embeddings` 提供服务——OpenAI 兼容。按 token 计费；`usage.total_tokens` 字段给出每次请求计费的 token 数。

```bash curl theme={null}
curl https://api.aisa.one/v1/embeddings \
  -H "Authorization: Bearer $AISA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "jina-embeddings-v3",
    "input": "A fast, OpenAI-compatible embeddings endpoint."
  }'
```

```bash curl (v5-text-small) theme={null}
curl https://api.aisa.one/v1/embeddings \
  -H "Authorization: Bearer $AISA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "jina-embeddings-v5-text-small",
    "input": "A fast, OpenAI-compatible embeddings endpoint."
  }'
```

```python Python theme={null}
from openai import OpenAI

client = OpenAI(base_url="https://api.aisa.one/v1", api_key="sk-aisa-...")

resp = client.embeddings.create(
    model="jina-embeddings-v5-text-small",  # or "jina-embeddings-v3"
    input="A fast, OpenAI-compatible embeddings endpoint.",
)

print(resp.data[0].embedding)  # 1024-dim vector
```

## 请求规范

* **方法与路径:** POST /embeddings
* **请求 URL 模板:** `https://api.aisa.one/v1/embeddings`

[完整 OpenAPI 定义](https://aisa.one/docs/reference-contracts/zh/jina.json)

有效请求声明（包括认证和引用的 schema）：

```json theme={null}
{
  "operationId": "createEmbedding",
  "method": "POST",
  "path": "/embeddings",
  "servers": [
    {
      "url": "https://api.aisa.one/v1"
    }
  ],
  "parameters": [],
  "security": [
    {
      "BearerAuth": []
    }
  ],
  "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
  },
  "components": {
    "securitySchemes": {
      "BearerAuth": {
        "bearerFormat": "API Key",
        "scheme": "bearer",
        "type": "http"
      }
    }
  }
}
```


## OpenAPI

````yaml reference-contracts/zh/jina.json POST /embeddings
openapi: 3.0.3
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
servers:
  - url: https://api.aisa.one/v1
security:
  - BearerAuth: []
tags:
  - name: Embeddings & Rerank
paths:
  /embeddings:
    post:
      summary: 创建 embeddings
      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 列表。
components:
  securitySchemes:
    BearerAuth:
      bearerFormat: API Key
      scheme: bearer
      type: http

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.