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

# API 参考

> 一个密钥、一个基础 URL，即可使用全部 API。浏览 AIsa 路由的所有端点及交互式示例。

AIsa 在 `https://api.aisa.one` 提供统一 API：兼容 OpenAI 的聊天接口位于 `/v1`，其他 API 位于 `/apis/v1`。使用 `AISA_API_KEY` 完成一次身份认证后，即可调用下方任意端点，包括聊天、视频、搜索、市场数据等。

侧栏先按分类、再按平台列出全部 API。要按平台名称查找 API，请使用 A–Z 索引。

> [card] [按平台浏览](https://aisa.one/docs/zh/api-reference/platforms.md)
>
> 按字母顺序列出全部平台，以及所属分类和端点数量。

## Unified API

AIsa Social、AIsa Ads 和 AIsa commerce 用一种请求格式覆盖多个平台。AIsa Social 和 AIsa Ads 通过用户连接的账户读写。先看 [Unified API 概览](https://aisa.one/docs/zh/resources/unified-apis.md)。

> [card] [AIsa Social](https://aisa.one/docs/zh/api-reference/aisa-social/get_aisa_social_apis_v1_social_account_groups.md)
>
> 在支持的平台上发帖、排期和回复，并提供数据分析和 Webhook。Reddit 社媒账号暂不可用，敬请期待。

> [card] [AIsa Ads](https://aisa.one/docs/zh/api-reference/aisa-ads/get_aisa_ads_apis_v1_ads_accounts.md)
>
> 在 Meta、Google、TikTok、LinkedIn、Pinterest、X、Reddit 和 OpenAI（ChatGPT）上投放广告。

> [card] [AIsa commerce](https://aisa.one/docs/zh/api-reference/aisa-commerce/get_aisa_commerce_apis_v1_commerce_amazon_categories.md)
>
> 商品、店铺、关键词和评论，每个值都标明来源。

## 常用 API

> [card] [聊天 API](https://aisa.one/docs/api-reference/chat/post_chat-completions.md)
>
> 兼容 OpenAI、Anthropic 和 Google 的聊天补全端点。

> [card] [搜索 API](https://aisa.one/docs/api-reference/search/get_youtube-search.md)
>
> YouTube SERP，以及 Tavily 搜索、内容提取、抓取和站点映射。

> [card] [Perplexity API](https://aisa.one/docs/api-reference/perplexity/post_perplexity-sonar.md)
>
> Sonar、Sonar Pro、Sonar Reasoning Pro 和 Sonar Deep Research。

> [card] [金融 API](https://aisa.one/docs/api-reference/financial/get_analyst-estimates.md)
>
> 公司基本面、申报文件、价格、内部人交易和宏观数据。

> [card] [Twitter API](https://aisa.one/docs/api-reference/twitter/get_twitter-user-info.md)
>
> 用户、推文、列表、社区、趋势、Space 和发帖端点。

> [card] [学术搜索 API](https://aisa.one/docs/api-reference/scholar/post_scholar-search-scholar.md)
>
> 用于研究的学术、网页、智能和解释型搜索。

> [card] [预测市场 API](https://aisa.one/docs/api-reference/prediction-market/get_polymarket-events.md)
>
> Polymarket、Kalshi 和市场匹配数据。

## 基础说明

> [card] [错误代码](https://aisa.one/docs/zh/api-reference/errors.md)
>
> 错误代码及其处理方式。

> [card] [速率限制](https://aisa.one/docs/zh/api-reference/rate-limits.md)
>
> 各端点的限制和响应头说明。

> [card] [额度余额](https://aisa.one/docs/zh/api-reference/credits-balance.md)
>
> 查询钱包余额和 API Key 实际可用额度。

## 已结算调用费用

Integration API 响应报告已结算客户扣费时，
`X-AISA-Customer-Cost-Micros-USD` 是以 micro-USD 为单位的非负十进制整数：
`1000000` 表示 `$1.00`。返回 `0` 表示本次报告的扣费为零。响应头缺失或格式无效时，
表示该响应没有提供可用的结算金额；**缺失不等于免费**。不要仅依据 HTTP 成功或失败、
价格档位或目录估算推断实际扣费。

网关通过 `Access-Control-Expose-Headers` 向浏览器调用方暴露该客户费用头。
接受的整数范围是 `0` 到 `9223372036854775807`；对账时使用整数或十进制表示，
不要先转换为浮点数。JavaScript 调用方应使用 `BigInt` 保存 micro-USD，或保留十进制字符串。

| 响应路径 | 费用头策略 |
| - | - |
| Metered V2 结算 | 可能返回 `X-AISA-Customer-Cost-Micros-USD` 和 `X-AISA-Provider-Cost-Micros-USD`。Provider 成本是独立账务证据，不是客户扣费；回退证据可能是估算。 |
| 固定/default 结算 | 报告已结算客户扣费，包括零；不新增暴露 Provider-cost micro-USD 头，并移除上游伪装提供的同名头。 |
| 报价、结算前拒绝、传输失败或特殊免客户费用路径 | 已结算费用头可能不存在。请遵循端点的报价或错误契约，不能将缺失解释成零费用。 |

Provider 成本头不在通用浏览器 CORS 暴露列表内。它们由具体端点及计费策略决定，
本页不保证它们出现，也不扩大暴露范围。尤其不能将 web-search 专用费用头视为所有
Integration API 的统一契约。

费用报价是在执行前返回的估算或上界，不是已经扣费的证明。请求头
`X-AISA-Max-Price-USD` 表示花费上限，不是实际扣费。MCP 结果字段取决于实际部署版本。
如果提供 `customer_cost_micros_usd` 和 `cost_usd_exact`，可用它们保留已报告的金额；
`cost_usd` 用于数字展示，极大数值可能被舍入。不要假定每个 MCP 部署都提供这些精确字段。
未知费用保持缺失，错误响应也是如此。不能用报价的 `estimated_cost_micros_usd` 代替已结算金额。

下面的 Python 示例接收不区分大小写的 HTTP 响应头映射（例如
`requests.Response.headers`），并保留精确十进制输出：

```python theme={null}
def settled_customer_cost(headers):
    raw = headers.get("X-AISA-Customer-Cost-Micros-USD")
    if raw is None:
        return None
    value = str(raw).strip()
    if not value.isascii() or not value.isdecimal():
        return None
    micros = int(value)
    if micros > 9223372036854775807:
        return None
    return {
        "customer_cost_micros_usd": micros,
        "cost_usd_exact": f"{micros // 1000000}.{micros % 1000000:06d}",
    }
```

兼容错误格式和安全重试方式见[错误代码](https://aisa.one/docs/zh/api-reference/errors.md)。


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