# 用 AnyRouter Artifacts 发布 ChatGPT 生成的网站

> ChatGPT 写 HTML，AnyRouter Artifacts 把它托管在一个稳定地址。可以在聊天里用 MCP 发布，也可以在终端用 anyr 发布。默认私密。

- Date: November 22, 2026
- Category: guides
- HTML: https://anyrouter.dev/blog/zh/publish-chatgpt-website-artifacts

## 从提示到网址

让 ChatGPT 写一个自包含的 `index.html`。把文件存进目录，用 anyr CLI 发布目录，复制命令输出的网址。页面默认私密，直到你修改 visibility。

- The link has the shape `https://anyrouter.dev/a/<id>`. It stays the same across versions.
- Every artifact starts `private`. Use `unlisted` for a link you send to one person, and `public` only when you want the gallery and search engines to see it.
- An account can hold 100 artifacts and 200 MB in current versions, with 20 publishes per hour.
- A folder publish accepts up to 50 files and 20 MB in the CLI. A single inline REST publish accepts 10 MB. The MCP `publish_artifact` tool takes 1 MB of text.
- An account can make artifacts public 24 hours after sign-up, up to 5 a day. These limits and the file types are in the [Artifacts API reference](https://anyrouter.dev/docs/api-reference/artifacts), read on 22 November 2026.

## 要求一份能真正渲染的文件

artifact 页面运行在沙箱 frame 中。它能读取同一版本里的其他文件，但不能请求外部网址。依赖 CDN 脚本或远程字体的页面会显示异常。

```text
Write a single self-contained index.html for a small project dashboard.
Put all CSS in a style tag and all JavaScript in a script tag.
Use inline SVG for icons. Do not load fonts, images or scripts from other URLs.
Use system fonts. Return only the file contents.
```

_A prompt that produces one publishable file._

如果回答包含多个文件，把它们存到同一目录。`index.html` 入口会优先打开。若目录里有两个候选入口，请用 `entry_path` 指定。

## 从终端发布

安装 CLI，登录，然后发布目录。CLI 会输出网址和版本号。

```bash
curl -fsSL https://anyr.dev/cli.sh | bash
anyr auth login
anyr artifact publish ./my-site --title "Weekend build" --visibility unlisted --json
```

```json
{
  "id": "k3Vx9TqLm2Ab7Zcd",
  "version": 1,
  "url": "https://anyrouter.dev/a/k3Vx9TqLm2Ab7Zcd",
  "visibility": "unlisted"
}
```

_The reply carries the stable id._

之后要替换页面，把新目录发布到同一个 id。已经拿到链接的人会看到最新版本。

```bash
anyr artifact publish ./my-site --id k3Vx9TqLm2Ab7Zcd --label "fix hero"
```

CLI 发布目录时会跳过点文件和 `node_modules`。单个文件按 UTF-8 文本上传，所以二进制图片请放进目录。

## 在 ChatGPT 中通过 MCP 发布

如果 ChatGPT 已安装 AnyRouter 插件并授予 Standard 权限，它无需终端就能调用 `publish_artifact`。该工具接收路径到文本内容的映射，适合一个 HTML 文件或一份小型 HTML 与 CSS 组合。

先阅读 [ChatGPT 连接器指南](https://anyrouter.dev/blog/anyrouter-chatgpt)，然后用自然语言提出发布请求。

```text
@AnyRouter Use publish_artifact with title "Weekend build" and visibility unlisted.
Files: index.html set to the complete HTML you just wrote.
Return the URL from the reply.
```

_Name the tool so the chat does not reach for another app._

该工具限制 1 MB 文本且不能携带图片。带二进制资源的站点请使用 REST 目录流程。流程会发送带大小和 SHA-256 的 manifest，上传缺失文件，再提交。



## 分享、检查与清理

用一次 PATCH 请求就能修改 visibility。Dashboard 的 Artifacts 页面提供相同控件。

| Visibility | Who can open it | Gallery | Search engines |
| --- | --- | --- | --- |
| `private` | Only you | No | No |
| `unlisted` | Anyone with the URL | No | No |
| `public` | Anyone with the URL | Yes | Yes |

- Your name stays off the page unless you set `show_author`. Email is never shown.
- The owner view reports daily views and visitors without storing an IP address.
- A private id answers 404 to everyone else, so the id is not a discovery path.
- Deleting an artifact stops its URL immediately. Do it only when you mean to.

A failed publish is usually one of four cases. `entry_ambiguous` means set `entry_path`. `413` means the inline body is too large, so use a folder. `403 account_too_new` means use `unlisted` for now. A blank page usually means the HTML called an external URL that the sandbox blocks.

## 下一步

发布一个页面，把链接发给一个人，再向同一个 id 发布第二个版本。整个流程就是这样。[Artifacts 发布公告](https://anyrouter.dev/blog/introducing-anyrouter-artifacts)介绍其他类型，包括 Markdown、Mermaid 图、表格和 React 组件。

Manage your pages in the dashboard.

[Open Artifacts](https://anyrouter.dev/dashboard/artifacts)
