# AnyRouter + ChatGPT：用 MCP 插件连接

> ChatGPT 无法更换自己的模型服务商。把 AnyRouter 添加为自定义 MCP 插件，就能在对话里查看模型、查询额度并发布页面。

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

## 今天可行的做法

ChatGPT 无法更换自己在对话中使用的模型。自定义 MCP 插件是受支持的桥梁。把 AnyRouter 添加为远程 MCP 服务，ChatGPT 就能在对话中调用我们的工具。

服务地址是 `https://anyrouter.dev/api/v1/mcp`。请在网页端添加。ChatGPT 通过 HTTPS 连接远程服务，支持 SSE 和流式 HTTP。本地 stdio 服务无法连接。

- There is no chat tool on the AnyRouter MCP server. Model calls go to `/api/v1/chat/completions`, `/api/v1/messages` or `/api/v1/responses`.
- ChatGPT's custom MCP plugin dialog offers OAuth and no authentication. It does not offer a static bearer token field as of 22 November 2026. AnyRouter supports OAuth with dynamic client registration and PKCE, so the web flow is the one to use.
- The Read-only permission bundle is the default. It includes `list_models`, `recommend_model`, artifact reads and credit reads. Standard adds the write tools, including `publish_artifact`.
- Write tools ask for confirmation before they run. Read-only tools carry a hint that clients use to skip the prompt.

工具列表刻意保持简短。`list_models` 会返回每个模型的 `access` 和 `can_route` 标记，对话就能判断哪些模型当前可路由，而不是依赖过期列表猜测。`recommend_model` 按价格或上下文过滤为某个任务排序。两个工具都不发起模型调用，因此不消耗推理额度。

限流也有文档。每个 credential 每分钟最多调用 120 次工具，每个 IP 在认证前每分钟最多 300 次请求。MCP 使用管理层限流，而非推理限流。工具陷入循环时会收到带重试提示的 429。

OpenAI 的[自定义 MCP 服务指南](https://developers.openai.com/api/docs/guides/custom-mcp-server)说明 ChatGPT 一侧的设置。[AnyRouter MCP 参考文档](https://anyrouter.dev/docs/api-reference/mcp)列出全部工具和权限。两者均于 2026 年 11 月 22 日查阅。

## 添加连接器

在浏览器中打开 [ChatGPT Plugins](https://chatgpt.com/plugins)，然后添加自定义 MCP 服务。





## 好用的提示词

ChatGPT 根据请求挑选工具。点名工具可以消除大部分歧义。下面的提示词只用服务器上真实存在的工具。

| Ask | Tool | Bundle |
| --- | --- | --- |
| Which models can you route for me right now? | `list_models` | Read-only |
| Recommend a cheap model for translation. | `recommend_model` | Read-only |
| How much credit is left in this workspace? | `get_credits` | Read-only |
| Show my artifacts. | `list_artifacts` | Read-only |
| Publish this HTML as an unlisted artifact. | `publish_artifact` | Standard |

具体的提示词比宽泛的更可靠。当两个应用有相似工具时，写明服务标签和工具名。OpenAI 指南也推荐这种做法。

```text
@AnyRouter Use the list_models tool with free_only set to true.
Show only models that can_route is true. Return a short table.
```

_A prompt that names the server and the tool._

## 连接器无法连接时

大多数失败原因都很短。

- Use ChatGPT on the web. The custom server flow is a web feature, and workspace rules can hide it.
- Open `https://anyrouter.dev/.well-known/oauth-authorization-server` in a browser. A JSON document with `authorization_endpoint` and `registration_endpoint` means discovery is reachable.
- If tools do not appear, start a new chat and select the plugin with `@`. Check the app settings page for a refresh action that pulls new tools.
- On a work or school account, ask the admin whether connectors are enabled. Workspace permissions apply to custom MCP servers.
- For a headless or local integration, skip the plugin. Use a bearer key from [Dashboard, Keys](https://anyrouter.dev/dashboard/keys) in a client that supports token auth.

在 Claude Code 中可用的 token 不能修好 ChatGPT 的对话框。两种客户端提供的认证方式不同。

## 从聊天中发布内容

安装插件并授予 Standard 权限后，可以让 ChatGPT 生成一个自包含的 HTML 页面，再用 `publish_artifact` 发布。该工具接受路径到文本内容的映射，所以一个 `index.html` 是最简单的情况。

[网站发布指南](https://anyrouter.dev/blog/publish-chatgpt-website-artifacts)覆盖完整流程，包括带图片目录的 CLI 方案。

Turn a chat-generated page into a shareable link.

[Read the guide](https://anyrouter.dev/blog/publish-chatgpt-website-artifacts)
