首次调用
欢迎使用华东师范大学大模型开放平台(ChatECNU)。平台 API 使用与 OpenAI / Anthropic 兼容的格式,通过修改配置即可使用 OpenAI / Anthropic SDK 或任意兼容工具访问。
| 项目 | 地址 |
|---|---|
| base_url(OpenAI 兼容) | https://chat.ecnu.edu.cn/open/api/v1 |
| base_url(Anthropic 兼容) | https://chat.ecnu.edu.cn/open/api/anthropic |
| api_key | 通过 我的令牌 申请 |
| model | ecnu-max、ecnu-plus |
ecnu-max为旗舰模型(思考模式 + 思考强度),ecnu-plus为通用模型(兼顾效果、成本与响应速度);两个模型均支持图片理解。模型详细信息见 模型介绍。
接入 Agent 工具
平台已接入多种主流 AI Agent 与编程助手工具,无需编写代码即可开始使用:
- Claude Code:Anthropic 官方命令行 AI 编程助手
- Codex CLI:OpenAI 官方终端 AI 编程助手
- VS Code Copilot:VS Code 内置 Copilot Chat(BYOK)
- OpenCode:开源 AI 编程助手
- Hermes:Nous Research 开源 AI Agent
更多工具(聊天客户端、翻译、学术研究等)接入方式见 接入 AI 工具。
使用 EduWork 桌面工作台
EduWork@ECNU(华师版) 是面向本校师生的 AI 桌面工作台。使用学校账号连接 ChatECNU 模型与校内搜索,围绕本机工作区资料制作文档、表格、演示文稿等成果。
调用对话 API
创建 API Key 之后,您可以使用以下样例脚本,通过 OpenAI API 格式访问平台模型。样例为非流式输出,您可以将 stream 设置为 true 来使用流式输出。
Anthropic API 格式的访问样例,请参考 Anthropic 兼容 API。
curl
bash
curl https://chat.ecnu.edu.cn/open/api/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${CHATECNU_API_KEY}" \
-d '{
"model": "ecnu-max",
"messages": [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Hello!"}
],
"thinking": {"type": "enabled"},
"reasoning_effort": "high",
"stream": false
}'python
python
from openai import OpenAI
client = OpenAI(
api_key="your_api_key", # 替换为您的API密钥
base_url="https://chat.ecnu.edu.cn/open/api/v1",
)
response = client.chat.completions.create(
model="ecnu-max",
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Hello!"},
],
thinking={"type": "enabled"},
reasoning_effort="high",
)
print(response.choices[0].message.content)nodejs
javascript
import OpenAI from "openai";
const client = new OpenAI({
apiKey: "your_api_key", // 替换为您的API密钥
baseURL: "https://chat.ecnu.edu.cn/open/api/v1",
});
const response = await client.chat.completions.create({
model: "ecnu-max",
messages: [
{ role: "system", content: "You are a helpful assistant." },
{ role: "user", content: "Hello!" },
],
thinking: { type: "enabled" },
reasoning_effort: "high",
});
console.log(response.choices[0].message.content);