接口规范#
开发者可直接使用 OpenAI 官方 Python 和 Node.js SDK 接入,只需要将官方 API 服务的基础 URL 更换为 MetaChat OpenAI API 服务的基础 URL 即可:api.openai.com -> llm-api.mmchat.xyz
gpt-5.2, gpt-5.2-chat, gpt-5.2-pro
gpt-5.1, gpt-5.1-codex-max, gpt-5.1-codex
gpt-5, gpt-5-mini, gpt-5-nano, gpt-5-chat-latest, gpt-5-codex
gpt-4.1, gpt-4.1-mini, gpt-4.1-nano
gpt-4o, gpt-4o-mini, chatgpt-4o-latest
gpt-image-1.5, gpt-image-1
接口鉴权#
调用 MetaChat OpenAI API 时,需 API Key 进行鉴权(API Key 获取方法请参考 概述 文档说明。与 OpenAI 官方接口鉴权规范相同,所有 API 请求都应在 HTTP Header 中包含 API Key,如下所示:调用样例#
安全提示:上述样例为了简洁起见,将 API Key 以字符串形式硬编码在代码中,实际生产环境建议采用环境变量(如 METACHAT_API_KEY)保存 API Key,并分别在 Python 和 Node.js 代码中引用。