從這四個呼叫開始
請逐一展開步驟。第 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 要求的語言。
為 AI 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 個免費額度。
- 測試金鑰只能在沙盒教室中使用,不會消耗額度。