先跑通这四个调用
逐个展开步骤。第 1 步设置的 TUTORFLOW_KEY 和 CLASSROOM_ID,后面的步骤都会用到。
需要 curl 和 jq。运行前请修改 slug 和邮箱。
1注册 Agent
无需密钥,调用一次即可。响应中包含 contentApiKey、defaultClassroomId 和 50 个试用额度。密钥只显示一次,请妥善保存。
RESPONSE=$(curl -s -X POST https://api.tutorflow.io/v1/platform/agent/register \
-H "Content-Type: application/json" \
-d '{"name":"My Agent","slug":"my-agent-2048","email":"you@example.com"}')
export TUTORFLOW_KEY=$(echo "$RESPONSE" | jq -r .contentApiKey)
export CLASSROOM_ID=$(echo "$RESPONSE" | jq -r .defaultClassroomId)2开始生成课程
TutorFlow 在后台生成课程,并返回 202 和 runId。单课节课程消耗 6 个额度。
RUN_ID=$(curl -s -X POST \
"https://api.tutorflow.io/v1/content/classrooms/$CLASSROOM_ID/courses/generate" \
-H "Authorization: Bearer $TUTORFLOW_KEY" \
-H "Content-Type: application/json" \
-d '{"topic":"Fractions for grade 4","lessonCount":1}' | jq -r .runId)3查询生成进度
每隔 20 到 30 秒查询一次,直到 status 变为 completed 或 failed。完成后,resourceId 就是新课程的 ID。
curl -s "https://api.tutorflow.io/v1/content/classrooms/$CLASSROOM_ID/runs/$RUN_ID" \
-H "Authorization: Bearer $TUTORFLOW_KEY" | jq '{status, resourceId, error}'4批改答案
批改结果即时返回,包含分数、优点和改进建议。每次批改消耗 1 个额度。
请求
curl -s -X POST "https://api.tutorflow.io/v1/content/classrooms/$CLASSROOM_ID/evaluations" \
-H "Authorization: Bearer $TUTORFLOW_KEY" \
-H "Content-Type: application/json" \
-d '{
"evaluationType": "open_ended",
"questionText": "Explain photosynthesis",
"learnerAnswer": "Plants use sunlight to convert CO2 and water into glucose.",
"maxScore": 10,
"language": "en",
"learnerExternalId": "learner-42"
}'响应
{
"id": "5023...",
"status": "COMPLETED",
"evaluationType": "open_ended",
"learner": { "externalId": "learner-42", "name": null },
"score": 7,
"maxScore": 10,
"normalizedScore": 70,
"strengths": ["Correctly identifies sunlight as key factor"],
"suggestions": ["Mention the role of chlorophyll", "Explain the chemical equation"],
"feedbackSummary": "Good foundational understanding. To improve, include the role of chlorophyll."
}习惯用终端?试试 CLI
@tutorflow/cli 也能发起同样的调用。agent register 会把密钥保存到 ~/.tutorflow/config.json,之后的命令无需再传密钥或课堂参数。
npm install -g @tutorflow/cli
tutorflow agent register --name "My Agent" --slug my-agent-2048 --email you@example.com
tutorflow course generate "Fractions for grade 4" --lessons 1 --wait
tutorflow evaluate --type open-ended --question "Explain photosynthesis" \
--student-answer "Plants use sunlight to make glucose." --learner-id learner-42无需人工介入,Agent 自己就能完成
一个 Content API 密钥即可通过 REST、MCP 和 CLI 调用。REST 覆盖全部功能,MCP 支持注册、计费、课程和批改。
批改学习者答案
提交答案并附上评分标准或参考答案,返回的分数、优点和改进建议都是带类型的字段。
生成教学材料
一次调用即可开始生成课程、考试、幻灯片、视频或学习模块,并可跟踪进度直到完成。
作为 MCP 工具调用
添加服务器地址和密钥后,Claude Code 或任何 MCP 客户端都能把 TutorFlow 当作工具使用。
无需人工即可注册
Agent 自行创建账号,同一个响应里就会拿到密钥、课堂和 50 个试用额度。
每次调用费用清清楚楚
每项操作从同一个余额中扣除固定数量的额度,每个额度 2 美分;开始运行前,estimatedCredits 会先给出费用。速率限制信息在响应头中返回。
按用途分配密钥
测试密钥与正式密钥分开使用,可为每个密钥设定权限范围并定期轮换。测试密钥在沙盒课堂中运行,不消耗额度。
任务完成即通知
注册 webhook 后,生成任务、视频渲染或批改一结束,就会收到带签名的请求。
按 Agent 指定的语言输出
内容和反馈都会使用 Agent 请求的语言。
为 Agent 而设计, 不只是给人用。
Agent 会自己发现并使用 TutorFlow 的工具:注册、查询余额、生成课程、跟踪进度、批改答案,无需编写 HTTP 代码。
- 在 MCP 客户端配置中添加一条服务器记录,Claude、Gemini 等任何 MCP 客户端都能连接
- Agent 自行注册,同一次调用即可拿到密钥
- 额度不足时,它会把付款链接发给人处理;在启用 x402 的环境中,也可以直接用 USDC 付款
- 输入带类型,调用出错时会返回具体原因
Claude Code
// .mcp.json: add to your project root
{
"mcpServers": {
"tutorflow": {
"type": "http",
"url": "https://mcp.tutorflow.io/api/mcp",
"headers": {
"Authorization": "Bearer tf_content_..."
}
}
}
}MCP SDK
import { Client } from '@modelcontextprotocol/sdk/client/index.js'
import { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js'
const transport = new StreamableHTTPClientTransport(
new URL('https://mcp.tutorflow.io/api/mcp'),
{
requestInit: {
headers: { Authorization: 'Bearer tf_content_...' },
},
},
)
const client = new Client({ name: 'my-agent', version: '1.0.0' })
await client.connect(transport)
// Call tools directly
const result = await client.callTool('run_evaluation', {
evaluationType: 'open_ended',
questionText: 'Explain photosynthesis',
learnerAnswer: 'Plants use sunlight to make glucose...',
})自助注册
// No auth needed: agents register themselves
POST https://api.tutorflow.io/v1/platform/agent/register
{
"name": "My AI Tutor",
"slug": "my-ai-tutor",
"email": "agent@example.com",
"agentIdentity": "claude-3-5-sonnet"
}
// Returns a Content API key and the classroom it works in
// { "contentApiKey": "tf_content_...", "defaultClassroomId": "...", "trialContentCredits": 50 }Agent 生成多少,就付多少
每次调用都从账号的同一个额度余额中扣除,每个额度 2 美分。下面是 Agent 实际计费所用的实时价目表。
| 生成内容 | 额度 | 美元 |
|---|---|---|
| 含大纲和所有课节的课程 | 3 额度 + 每个课节 6 额度 | US$0.06 + 每个课节 US$0.12 |
| 一个课节模块 | 每个课节 6 额度 | 每个课节 US$0.12 |
| 含自动评分题目的考试 | 每场考试 3 额度 | 每场考试 US$0.06 |
| 幻灯片中的文字页 | 每张文字页 1 额度 | 每张文字页 US$0.02 |
| 带 AI 图片的幻灯片页 | 每张图片页 3 额度 | 每张图片页 US$0.06 |
| 视频场景旁白 | 每个场景 1 额度 | 每个场景 US$0.02 |
| 将视频渲染为 MP4 | 每次渲染 3 额度 | 每次渲染 US$0.06 |
| 即开即玩的游戏 | 每个游戏 41 额度 | 每个游戏 US$0.82 |
| 批改一份答案 | 每次请求 1 额度 | 每次请求 US$0.02 |
计费方式
- 邮箱验证后即可用银行卡或 Base 网络上的 USDC 充值,最低 5 美元。
- 绑定银行卡后,额度用完时工作仍会继续,这部分用量从该卡扣款。
- 新账号自带 50 个免费额度。
- 测试密钥只能在沙盒课堂中使用,不会消耗额度。