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

# 在 Codex 中使用 AIsa

> 只需一条命令和一次浏览器登录，即可在 OpenAI 的 Codex CLI 中将 AIsa 添加为远程 MCP 服务器。可选在 AIsa 模型上运行 Codex。

Codex 内置了 MCP 客户端。将 AIsa 添加为远程 MCP 服务器并登录一次，Codex 即可发现并调用 AIsa 在网络调研、金融、社交、SEO、销售等领域的各项能力。

AIsa MCP 服务器：

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

## 前提条件

开始之前，请确保你已具备：

* AIsa 账号（[console.aisa.one](https://console.aisa.one)）。你将通过浏览器登录。
* macOS、Linux 或 Windows WSL2 上的终端

## 1. 安装 Codex

```bash theme={null}
npm install -g @openai/codex
```

或使用 Homebrew：

```bash theme={null}
brew install codex
```

验证安装：

```bash theme={null}
codex --version
```

## 2. 添加 AIsa MCP 服务器

```bash theme={null}
codex mcp add aisa --url https://mcp.aisa.one/mcp
```

Codex 会检测到 AIsa 使用 OAuth 并打开你的浏览器。登录 AIsa 并批准访问；无需复制任何密钥。在没有浏览器的机器上，运行 `codex mcp login aisa --no-browser` 并在其他设备上打开输出的 URL。

> [accordion] 使用 API key 代替 OAuth
>
> 对于无头环境，导出你的 AIsa 密钥并告知 Codex 存储该密钥的环境变量。Codex 会在运行时读取它，因此密钥绝不会写入 `config.toml`：
>
> ```bash theme={null}
> export AISA_API_KEY="sk-aisa-..."
> codex mcp add aisa --url https://mcp.aisa.one/mcp --bearer-token-env-var AISA_API_KEY
> ```

## 3. 验证

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

**aisa** 应列为 `enabled`，且 Auth 列显示 `OAuth`（或 `Bearer token`）。启动新的 Codex 会话以加载工具；在 Codex 内部，输入 `/mcp` 可查看已连接的服务器。

## 4. 使用 AIsa 能力

```bash theme={null}
codex
```

Codex 现在已拥有 AIsa 工具。`search`、`list_categories`、`get_details`、`batch_get_schema` 和 `batch_quote`（对具体调用进行报价而不实际执行）是免费的；`use` 和 `batch_use` 会执行调用并按次计费。

尝试：

```txt theme={null}
使用 AIsa 能力搜索网络并总结关于 Codex CLI 的最新信息。
```

## 可选：在 AIsa 模型上运行 Codex

Codex 还可以将 AIsa 用作模型提供商。这需要一个导出为 `AISA_API_KEY` 的 AIsa API key（[console.aisa.one/api-keys](https://console.aisa.one/api-keys)）。将以下内容添加到 `~/.codex/config.toml`：

```toml theme={null}
model = "gpt-5.5"
model_provider = "aisa"

[model_providers.aisa]
name = "AIsa"
base_url = "https://api.aisa.one/v1"
env_key = "AISA_API_KEY"
wire_api = "responses"
```

* `env_key` 告知 Codex 哪个环境变量存储了你的密钥。
* Codex 仅支持 `wire_api = "responses"`，因此请在[模型目录](https://aisa.one/docs/zh/guides/models.md)中选择列有 `POST /v1/responses` 的模型，例如 `gpt-5.5`、`gpt-5.4` 或 `gpt-5.3-codex`。

## 快速参考

| 项目 | 值 |
| - | - |
| 添加 AIsa | `codex mcp add aisa --url https://mcp.aisa.one/mcp`（OAuth 自动启动） |
| 重新登录 | `codex mcp login aisa` |
| 检查状态 | `codex mcp list`，或在 Codex 内部输入 `/mcp` |
| API key | MCP 不需要；可选 `--bearer-token-env-var AISA_API_KEY` |
| 可选模型提供商 | `base_url = "https://api.aisa.one/v1"`，`wire_api = "responses"` |

## 故障排查

| 问题 | 解决办法 |
| - | - |
| AIsa 工具缺失 | 运行 `codex mcp list`。若 **aisa** 显示 `Not logged in`，运行 `codex mcp login aisa`，然后启动新会话 |
| 浏览器未打开 | 运行 `codex mcp login aisa --no-browser` 并在其他设备上打开输出的 URL |
| `wire_api = "chat"` 不再受支持 | 在 provider 配置块中设置 `wire_api = "responses"` |
| 模型提供商返回 401 | 确认运行 Codex 的 Shell 中已导出 `AISA_API_KEY` |
| 模型提供商返回 404 | 确保 `base_url` 完全为 `https://api.aisa.one/v1` |
| 未找到模型 | 请使用[模型目录](https://aisa.one/docs/zh/guides/models.md)中支持 `POST /v1/responses` 的确切模型 ID |

## 相关

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

> [card] [通过 MCP 连接](https://aisa.one/docs/zh/agent-quickstart.md)
>
> 其他客户端的 MCP 配置。

> [card] [模型目录](https://aisa.one/docs/zh/guides/models.md)
>
> 浏览支持 Responses API 的模型。


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