Skip to content

首次调用

欢迎使用华东师范大学大模型开放平台(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通过 我的令牌 申请
modelecnu-maxecnu-plus

ecnu-max 为旗舰模型(思考模式 + 思考强度),ecnu-plus 为通用模型(支持图片理解)。模型详细信息见 模型介绍

接入 Agent 工具

平台已接入多种主流 AI Agent 与编程助手工具,无需编写代码即可开始使用:

更多工具(聊天客户端、翻译、学术研究等)接入方式见 接入 AI 工具

调用对话 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);

更多示例(流式、function call、多模态等)见 示例代码通用对话接口