摘要
让你的 AI 用你自己的密钥使用 OpenAI API:通过 Responses API 向 GPT 模型提问,分析链接中的图片,生成和编辑直接显示在聊天中的图片,创建嵌入向量,用审核功能检查内容,并读取模型、文件和批处理任务。
引导式设置
2 分钟将 OpenAI API 连接到 Microsoft Copilot
开始 AnythingMCP Cloud 免费试用,在引导式设置中连接 OpenAI API,再把你的 MCP URL 添加到 Microsoft Copilot。无需代码,也无需自行运行服务器。
无需信用卡 · 7 天试用 · 提供自托管方案
试试这样问
OpenAI API 的示例提示
点击任意提示即可复制,然后粘贴到 Claude、ChatGPT、Cursor、Gemini、Copilot 或 OpenClaw 中,在该连接器上运行。
Claude 是 AI,可能会出错。请核对回答。
💡 无需安装? 直接使用 cloud.anythingmcp.com。 登录、点击 Connectors → OpenAI API、粘贴凭证、生成 MCP API key,即可完成。无 Docker、无
git clone、无本地服务器。
OpenAI API + Microsoft Copilot
让你的 AI 用你自己的密钥使用 OpenAI API:通过 Responses API 向 GPT 模型提问,分析链接中的图片,生成和编辑直接显示在聊天中的图片,创建嵌入向量,用审核功能检查内容,并读取模型、文件和批处理任务。
前提条件
完整的设置说明已内置在连接器中 (在 store 中选择连接器时可见)。所需环境变量:
OPENAI_API_KEY
步骤 1 — 获取凭证
- 登录
https://platform.openai.com,在 Settings、Billing 中充值。API 采用预付费:ChatGPT 订阅不包含 API 访问权限。 - 打开
https://platform.openai.com/api-keys,点击 Create new secret key,选择项目并复制密钥。密钥以sk-开头,只显示一次。 - 按 OpenAI 显示的原样(不加 Bearer 一词)将密钥粘贴到
OPENAI_API_KEY,然后安装连接器。密钥只会发送给 OpenAI。 - 可选:只有当密钥所属用户加入了多个组织时,才设置
OPENAI_ORGANIZATION(位于 Settings、Organization、General 的 Organization ID,以org-开头);只有需要把用量计入某个特定项目时,才设置OPENAI_PROJECT(位于 Settings、Project、General 的 Project ID,以proj_开头)。其他情况下两者都留空:与密钥不匹配的值会被拒绝并返回 401。 - 要使用图片工具,请在 Settings、Organization、General、Verify Organization 中验证你的组织。未验证时,GPT 图片模型会返回 403。
- 运行
openai_list_models。它不收费,会显示你的密钥可以使用哪些模型。
计费:每次模型调用都计入该密钥所属的 OpenAI 账户。审核以及模型、文件和批处理列表均免费。除非你要求更高规格,连接器会使用低价默认值:文本用 gpt-6-luna(每百万输入 token 约 0.10 美元,每百万输出 token 约 0.50 美元),图片用中等质量的 gpt-image-1-mini(每张约 0.01 美元)。更强的文本模型价格是其 20 到 100 倍,网页搜索按次计费。
功能:通过 Responses API 向 OpenAI 模型提问(文本、链接图片、网页搜索、结构化输出),生成和编辑显示在聊天中的图片,一次为最多 20 段文本创建嵌入向量,用审核功能检查文本和图片,并读取你的模型、文件以及在其他地方启动的 Batch API 任务。
先确认:每张图片都要花钱,因此 AI 在每次调用 openai_generate_image 或 openai_edit_image 之前都会先征得你的确认,并且除非你要更多,只生成一张。openai_delete_file 在安装时处于关闭状态;启用后它同样会先确认,且删除的文件无法恢复。
常见错误:401 表示密钥错误或已被撤销,或者组织 ID 或项目 ID 与密钥不匹配。403:组织未验证(图片模型),或者该组织无法使用此模型或区域。404 model_not_found:用 openai_list_models 检查。429 insufficient_quota:余额用完或已达到支出上限,请充值。429 rate_limit_exceeded:稍等后重试一次。400 moderation_blocked 或 content_policy_violation:OpenAI 的安全系统拒绝了该提示。
该连接器不涵盖 chat completions(Responses API 已覆盖相同功能)、音频(语音合成和转录)、realtime、视频、文件上传和下载、创建批处理、微调、vector stores、assistants 以及 admin API。
步骤 2 — 安装 adapter
curl -fsSL https://raw.githubusercontent.com/HelpCode-ai/anythingmcp/main/docker-compose.quickstart.yml -o docker-compose.yml
printf 'JWT_SECRET=%s\nENCRYPTION_KEY=%s\n' "$(openssl rand -hex 32)" "$(openssl rand -hex 32)" > .env
docker compose up -d
步骤 3 — 在 Microsoft Copilot 中添加连接器
你的服务器 URL: 在 AnythingMCP 中打开 MCP Servers → 此连接器所在的服务器,复制它的 URL(
https://cloud.anythingmcp.com/mcp/…)。本指南中出现YOUR_SERVER_ID的地方都用它替换。
Microsoft Copilot 通过在 Copilot Studio 中构建的智能体使用 MCP 服务器:把 AnythingMCP 作为工具添加到智能体,然后把智能体发布到 Microsoft 365 Copilot 和 Teams。Copilot Studio 从 Microsoft 的云端通过 Streamable HTTP 连接,AnythingMCP 支持这种方式。
- 在 Copilot Studio 中打开你的智能体(或新建一个),进入 Tools,选择 Add a tool → New tool → Model Context Protocol。
- 填写 Server name(例如
AnythingMCP)、说明连接器用途的 Server description,以及 Server URLhttps://cloud.anythingmcp.com/mcp/YOUR_SERVER_ID。Copilot Studio 根据描述决定何时调用该服务器。 - 身份验证选择 API key,把 Type 设为 Header,请求头名称填
X-API-Key,然后选择 Create。 - 在 Add tool 中选择 Create a new connection,粘贴 AnythingMCP 的 MCP API 密钥(MCP Servers → 你的服务器 → API keys),然后选择 Add to agent。
- 在智能体的 Test 窗格中试一试:提出需要用到
OpenAI API的工具的请求。 - 选择 Publish,然后进入 Channels → Microsoft 365 and Microsoft Teams,保持勾选 Make agent available in Microsoft Copilot,再选择 Add channel。See agent in Teams 会为你安装该智能体;在 Microsoft 365 Copilot 中输入 @ 并选择该智能体。
希望每个用户各自登录?请选择 OAuth 2.0 → Dynamic discovery 代替 API 密钥:每个用户会在智能体首次调用时登录 AnythingMCP。
自托管?请用你实例的公网 HTTPS 地址替换 https://cloud.anythingmcp.com。Copilot Studio 从 Microsoft 的云端连接,因此 localhost 无法使用。
可用工具
| Tool | What it does |
|---|---|
openai_list_models | List the OpenAI models this API key can use (chat and reasoning, image, embedding, moderation, audio), with owner, creation time and… |
openai_get_model | Read one OpenAI model: id, owner, creation time and shutdown date when one is announced |
openai_create_response | Ask an OpenAI model and get its answer (Responses API). input is either a plain prompt string or a list of items, e.g. [{"role": "user"… |
openai_generate_image | Create pictures from a text description with an OpenAI GPT image model and return them as images the user can see |
openai_edit_image | Change existing pictures with an OpenAI GPT image model, or combine several into a new one: describe the edit and pass the pictures by… |
openai_create_embeddings | Turn one text, or a list of up to 20 texts, into embedding vectors for semantic search, clustering or similarity |
openai_moderate | Check text, or text with images, against OpenAI's content policy categories (harassment, hate, self-harm, sexual, violence, illicit and… |
openai_list_files | List the files stored in the OpenAI account (for batches, fine-tuning, assistants, vision or user data), newest first, with id, name, size… |
openai_get_file | Read the details of one file in the OpenAI account: name, size in bytes, purpose, creation time and expiry |
openai_delete_file | Delete a file from the OpenAI account |
openai_list_batches | List the Batch API jobs of the account, newest first: endpoint, model, status (validating, in_progress, finalizing, completed, failed… |
openai_get_batch | Read one Batch API job: status, timestamps of each stage, request counts (total, completed, failed), token usage, errors and the… |
示例提示
- “看看这个链接里的商品照片,为我们的网店写一段简短、亲切的介绍。”
- “为一条社交媒体帖子生成一张木桌上陶瓷咖啡杯的图片,但在生成之前先告诉我使用的模型和预估费用。”
- “用审核功能检查这五条客户评论,告诉我哪些被标记了,以及原因。”
- “我们的密钥可以使用哪些 OpenAI 模型?其中有没有已公布停用日期的?”
FAQ
这适用于哪个 Copilot? 适用于工作中的 Microsoft 365 Copilot,通过 Copilot Studio 的智能体实现。面向个人账户的 Microsoft Copilot 应用无法添加自己的 MCP 服务器。
我需要什么? 一个可以使用 Copilot Studio 的工作账户(许可证或试用版),用于构建智能体。在 Microsoft 365 Copilot 或 Teams 中使用它的人需要拥有该智能体的访问权限:把它共享给他们,或请管理员为整个组织发布。如果你的组织对 Power Platform 连接器设置了数据策略,这些策略同样适用于 MCP 服务器。
智能体不调用工具。 检查请求头名称是否正好是 X-API-Key,密钥是否属于与 URL 相同的 MCP 服务器,并把 Server description 写得具体:Copilot Studio 根据它决定何时调用服务器。每次修改后重新发布智能体;在已打开的对话中输入 "start over" 即可使用新版本。
下一步
这份指南对你有帮助吗?