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

# Claude Cowork 3P

> 将 AIOHub 配置为 Claude Cowork 第三方推理网关。

[Claude Cowork 3P](https://claude.com/docs/cowork/3p/overview) 是 Claude Desktop 的第三方推理部署模式。启用后，Cowork 和 Code 标签页会把模型推理请求发送到你配置的网关，而不是使用 Anthropic 官方推理服务。

AIOHub 支持 Claude Messages 协议。配置 Cowork 3P 时，把 AIOHub 作为 `gateway` 类型的推理网关即可。

<Warning>Claude Cowork 3P 仍处于公开测试阶段，具体入口和管理方式可能随 Claude Desktop 版本变化。本文按 Anthropic 当前公开的 3P 配置键说明。</Warning>

<Warning>即便使用 AIOHub API，Claude Cowork 3P 仍只能在 Anthropic 提供服务的国家或地区使用，不包括中国大陆、香港和澳门。你需要自行解决 Claude Desktop、Claude 账号和相关网络访问问题。</Warning>

## 模型范围

在 Claude Cowork 3P 中使用 AIOHub API 时，模型范围不限于 Anthropic / Claude 模型。只要你的 API 令牌分组可见，并且 AIOHub 当前支持通过 Claude Messages 兼容网关调用，你也可以选择 OpenAI、开源模型等其他模型。

如果你使用包含 `auto` 分组的 API 令牌，Cowork 3P 的模型选择界面可以展示并选择多种可用模型。实际可选列表仍以当前 API 令牌可见模型为准；建议先在控制台或通过 `/v1/models` 确认模型名称。

## 前置条件

* 已安装支持 Cowork 3P 的 Claude Desktop
* 已 [创建 AIOHub API 令牌](/cn/account/create-token)
* API 令牌的分组包含 Claude / Anthropic-compatible 模型
* 账户有充足余额

## 最小配置

配置 AIOHub 时，只需要填写两个字段：

| 字段               | 值                        |
| ---------------- | ------------------------ |
| Gateway base URL | `https://api.aiohub.org` |
| Gateway API key  | `sk-你的API令牌`             |

<Note>`inferenceGatewayBaseUrl` 填网关根地址，不要加 `/v1`。Cowork 3P 会向网关请求 `POST /v1/messages`；如果你填成 `https://api.aiohub.org/v1`，客户端可能请求到错误路径。</Note>

`Gateway auth scheme` 和 `Model list` 可以保持默认值，不需要手动填写。使用包含 `auto` 分组的 API 令牌时，模型选择界面会按当前令牌可见模型展示可选项。

## 配置模型联网访问

如果你希望 Claude Cowork 3P 中的模型使用联网能力，再配置 **Allowed egress hosts**。它对应的配置键是 `coworkEgressAllowedHosts`，控制 Cowork 沙箱内的网页抓取、Shell 命令和包安装可以访问哪些主机。

常见配置方式：

| 目标            | `coworkEgressAllowedHosts`              |
| ------------- | --------------------------------------- |
| 允许访问全部网址      | `["*"]`                                 |
| 只允许访问指定域名     | `["docs.aiohub.org", "api.github.com"]` |
| 允许访问某个域名及其子域名 | `["*.example.com"]`                     |

<Warning>设置为 `["*"]` 会关闭 Cowork 沙箱的出站主机过滤，模型工具可以访问任意网址。个人测试时最方便；团队或生产环境建议只放行确实需要访问的域名。</Warning>

<Note>`coworkEgressAllowedHosts` 控制的是 Cowork 沙箱内工具访问外部网站的范围，不是 AIOHub 模型推理网关的 Base URL。你配置的推理端点会被隐式允许访问。</Note>

## 使用应用内配置向导

<Steps>
  <Step title="打开第三方推理配置">
    启动 Claude Desktop，进入 **Developer** → **Configure third-party inference**。
  </Step>

  <Step title="选择 Gateway">
    在推理服务商中选择 **Gateway**。这个模式适用于实现 Anthropic Messages API 的网关。
  </Step>

  <Step title="填写 AIOHub 信息">
    只填写这两个字段：

    | 字段               | 值                        |
    | ---------------- | ------------------------ |
    | Gateway base URL | `https://api.aiohub.org` |
    | Gateway API key  | `sk-你的API令牌`             |

    `Gateway auth scheme` 和 `Model list` 保持默认值即可。如果你的 API 令牌使用 `auto` 分组，模型选择界面会展示当前令牌可见的多种模型。

    如果你希望模型可以联网访问外部网站，再配置 **Allowed egress hosts**。要访问任意网址，填 `*`；如果只希望访问特定网站，逐项填写主机名，例如 `docs.aiohub.org` 或 `*.example.com`。
  </Step>

  <Step title="导出配置">
    使用向导导出 macOS 的 `.mobileconfig` 或 Windows 的 `.reg` 配置。测试单机时也可以写入本地用户配置。
  </Step>

  <Step title="重启 Claude Desktop">
    关闭并重新打开 Claude Desktop。看到 Cowork 和 Code 标签页，并且可以选择通过 Gateway 进入，说明 3P 模式已被识别。
  </Step>
</Steps>

## 本地用户配置示例

如果你不通过 MDM 下发配置，可以在本地用户配置中加入 `enterpriseConfig`。适合个人测试，不适合团队分发真实 API 令牌。

<Tabs>
  <Tab title="macOS">
    配置文件位置：

    ```text theme={"system"}
    ~/Library/Application Support/Claude-3p/claude_desktop_config.json
    ```

    最小示例：

    ```json theme={"system"}
    {
      "enterpriseConfig": {
        "inferenceProvider": "gateway",
        "inferenceGatewayBaseUrl": "https://api.aiohub.org",
        "inferenceGatewayApiKey": "sk-你的API令牌"
      }
    }
    ```

    如果需要模型联网访问全部网址，额外加入：

    ```json theme={"system"}
    {
      "enterpriseConfig": {
        "inferenceProvider": "gateway",
        "inferenceGatewayBaseUrl": "https://api.aiohub.org",
        "inferenceGatewayApiKey": "sk-你的API令牌",
        "coworkEgressAllowedHosts": ["*"]
      }
    }
    ```
  </Tab>

  <Tab title="Windows">
    配置文件位置：

    ```text theme={"system"}
    %APPDATA%\Claude-3p\claude_desktop_config.json
    ```

    最小示例：

    ```json theme={"system"}
    {
      "enterpriseConfig": {
        "inferenceProvider": "gateway",
        "inferenceGatewayBaseUrl": "https://api.aiohub.org",
        "inferenceGatewayApiKey": "sk-你的API令牌"
      }
    }
    ```

    如果需要模型联网访问全部网址，额外加入：

    ```json theme={"system"}
    {
      "enterpriseConfig": {
        "inferenceProvider": "gateway",
        "inferenceGatewayBaseUrl": "https://api.aiohub.org",
        "inferenceGatewayApiKey": "sk-你的API令牌",
        "coworkEgressAllowedHosts": ["*"]
      }
    }
    ```
  </Tab>
</Tabs>

<Warning>不要把包含真实 API 令牌的配置文件提交到 Git，也不要把同一个高权限 API 令牌发给多个不受控设备。团队部署时建议为 Cowork 3P 创建独立 API 令牌，并按用途限制分组。</Warning>

## 验证网关

先用 HTTP 请求确认 AIOHub API 令牌和模型可用：

```bash theme={"system"}
curl https://api.aiohub.org/v1/messages \
  -H "x-api-key: sk-你的API令牌" \
  -H "anthropic-version: 2023-06-01" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-sonnet-4-20250514",
    "max_tokens": 128,
    "messages": [{"role": "user", "content": "Hello from Claude Cowork 3P"}]
  }'
```

如果返回正常，再启动 Claude Desktop。发送一条简短消息后，回到 AIOHub 控制台的 **日志** 页面，确认请求、模型、分组和扣费记录。

## 常见问题

<AccordionGroup>
  <Accordion title="启动后仍然进入普通 Claude 登录">
    检查 `inferenceProvider` 是否设置为 `gateway`，以及 `inferenceGatewayBaseUrl` 和 `inferenceGatewayApiKey` 是否同时存在。Cowork 3P 只有在推理服务商和必填凭证有效时才会进入第三方模式。
  </Accordion>

  <Accordion title="请求路径错误或连接失败">
    确认 Gateway base URL 是 `https://api.aiohub.org`，不要包含 `/v1`。Cowork 3P 会自行请求 `/v1/messages`。
  </Accordion>

  <Accordion title="模型列表为空">
    AIOHub 支持 `/v1/models`，但可见模型仍取决于 API 令牌的分组。通常保持 Model list 默认即可；只有在客户端没有正确展示模型时，再显式设置 `inferenceModels`，例如 `claude-sonnet-4-20250514`。
  </Accordion>

  <Accordion title="鉴权失败">
    通常保持 Gateway auth scheme 默认即可。如果你的客户端版本没有自动识别 `sk-` API 令牌，可显式设置为 `auto`，或改为 `x-api-key` 后重试。
  </Accordion>

  <Accordion title="没有 Chat 标签页">
    这是 Cowork 3P 的预期限制之一。第三方推理模式主要提供 Cowork 和 Code 标签页，不等同于普通 Claude Chat。
  </Accordion>

  <Accordion title="模型无法访问网页">
    检查 **Allowed egress hosts** 是否包含目标网站主机名。要允许访问全部网址，可以设置为 `*`；在 JSON 配置中写作 `"coworkEgressAllowedHosts": ["*"]`。
  </Accordion>
</AccordionGroup>

## 官方参考

* [Claude Cowork 3P overview](https://claude.com/docs/cowork/3p/overview)
* [Claude Cowork 3P configuration reference](https://claude.com/docs/cowork/3p/configuration)
* [Install and configure Claude Cowork with third-party platforms](https://support.claude.com/en/articles/14680741-install-and-configure-claude-cowork-with-third-party-platforms)
