> ## 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

# 在 Pi 中使用 AIsa

> 一条命令，把 AIsa 添加为 Pi 编程智能体的远程 MCP server。

Pi 内置 MCP client。把 AIsa 添加为远程 MCP server，并用你的 AIsa API key 认证，Pi 的智能体就能发现并调用 AIsa 能力——网页研究、金融、社交、SEO、销售等。

AIsa MCP endpoint：

```txt theme={null}
https://mcp.aisa.one/mcp
```

## 前置条件

开始前，请确认你已经具备：

* AIsa API key（[console.aisa.one/api-keys](https://console.aisa.one/api-keys)）
* 已安装 [Pi](https://pi.dev)，且支持内置 MCP（`pi mcp --help` 可用）

## 1. 导出 AIsa key

Pi 从环境变量读取 key，不会写进配置文件。把这一行加入 `~/.zshrc` 或 `~/.bashrc`：

```bash theme={null}
export AISA_API_KEY="sk-aisa-..."
```

启动 Pi 前，打开新的 terminal 或 `source` 该文件。

## 2. 让 Pi 连接 AIsa

启动 `pi` 并发送：

```txt theme={null}
Read https://aisa.one/llms.txt and help me connect to AIsa.
```

Pi 会读取 AIsa 面向智能体的说明，并用你的 `AISA_API_KEY` 在全局注册 AIsa MCP server。

> [!TIP]
>
> 想自己动手？运行 Pi 执行的同一条命令：
>
> ```bash theme={null}
> pi mcp add aisa \
>   --url https://mcp.aisa.one/mcp \
>   --bearer-token-env-var AISA_API_KEY \
>   --description "AIsa capability layer: discover and call APIs across web, finance, social, SEO, sales, and more."
> ```

## 3. 验证并重新加载

检查连接：

```bash theme={null}
pi mcp list
```

应当看到：

```txt theme={null}
aisa: connected, 7 tools (codemode, global)
  https://mcp.aisa.one/mcp
  tools: list_categories, search, get_details, batch_get_schema, batch_quote, use, batch_use
```

如果是在运行中的 Pi 会话里添加的 server，输入 `/reload` 让当前会话加载新工具。

## 4. 使用 AIsa 能力

让 Pi 获取任何 AIsa 能提供的数据，例如：

```txt theme={null}
Use AIsa to check the recent posts of Sam Altman. Ask me before any paid call.
```

Pi 会搜索 AIsa 目录、读取匹配操作的 schema，为调用报价，然后执行并报告费用。各工具分工如下：

| 工具 | 作用 | 计费 |
| - | - | - |
| `list_categories` | 列出能力分类 | 免费 |
| `search` | 按自然语言任务查找操作 | 免费 |
| `get_details` | 返回最多 20 个工具的完整契约（schema、副作用、注意事项）；也以 `batch_get_schema` 提供 | 免费 |
| `batch_quote` | 为最多 20 个确切调用报价，不执行 | 免费 |
| `batch_use` | 执行最多 20 个已报价的调用 | 计费 |
| `use` | 已弃用的单次调用形式 | 计费 |

## 快速参考

| 项目 | 值 |
| - | - |
| MCP URL | `https://mcp.aisa.one/mcp` |
| 认证 | 来自 `AISA_API_KEY` 的 Bearer token |
| 添加命令 | `pi mcp add aisa --url https://mcp.aisa.one/mcp --bearer-token-env-var AISA_API_KEY` |
| 全局配置 | `~/.pi/agent/mcp.json` |
| 验证 | `pi mcp list` |
| 加载到运行中的会话 | `/reload` |

## 故障排查

| 问题 | 解决方法 |
| - | - |
| `pi mcp list` 显示认证错误（401） | 在启动 Pi 的 shell 中确认 `echo $AISA_API_KEY` 能打印出 key，并在[控制台](https://console.aisa.one)确认 key 有效 |
| 当前会话里没有 AIsa 工具 | 输入 `/reload`，或开启新的 Pi 会话 |
| 没有 `pi mcp` 命令 | 把 Pi 升级到支持内置 MCP 的版本 |
| 只想在某个项目中启用 AIsa | 把 server 添加到项目的 `.pi/mcp.json`，而不是全局配置 |

## 相关页面

> [card] [在 Claude 中使用 AIsa](https://aisa.one/docs/zh/guides/tutorials/use-aisa-in-claude.md)
>
> 在 Claude 中把 AIsa 添加为自定义连接器。

> [card] [认证](https://aisa.one/docs/zh/guides/authentication.md)
>
> API key 创建、轮换和存储最佳实践。

> [card] [Agent Skills](https://aisa.one/docs/zh/agent-skills.md)
>
> 浏览 AIsa 向智能体开放的能力。


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