원클릭으로
dev-test-api
用 curl 测试 dev 服务器 API 端点。Use to verify API behavior, test streaming, or debug issues end-to-end.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
用 curl 测试 dev 服务器 API 端点。Use to verify API behavior, test streaming, or debug issues end-to-end.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
Add a new FastAPI API endpoint. Use when creating new REST API routes for the application.
Add a new LLM provider to fusion-api. Use when integrating a new AI model service.
Fusion API 项目架构、技术栈、核心组件总览。Use when you need to understand how the backend works, its architecture, or tech stack.
Quick reference for all API endpoints. Use when you need to know available endpoints, their methods, and purposes.
Debug streaming issues (stop not working, content loss, reconnect problems). Use when SSE streaming has bugs.
查看 dev 服务器 fusion-api 日志。Use when debugging backend issues, checking errors, or tracing request flow.
| name | dev-test-api |
| description | 用 curl 测试 dev 服务器 API 端点。Use to verify API behavior, test streaming, or debug issues end-to-end. |
| argument-hint | ["测试场景描述"] |
| allowed-tools | Bash |
通过 curl 直接调用 dev 服务器的 API,验证功能闭环。
TOKEN=$(ssh dev "curl -s -X POST http://localhost:8100/auth/login \
-H 'Content-Type: application/json' \
-d '{\"email\":\"Codex-test@fusion.dev\",\"password\":\"test123456\",\"client_id\":\"app_a93ea0569cafafe6299c7f660669a5b7\"}' \
| python3 -c 'import sys,json;print(json.load(sys.stdin)[\"access_token\"])'")
测试账号:Codex-test@fusion.dev / test123456,token 有效期 24 小时。
ssh dev "timeout 5 curl -s -N \
-H 'Authorization: Bearer $TOKEN' \
-H 'Content-Type: application/json' \
-X POST http://localhost:8002/api/chat/send \
-d '{\"model_id\":\"qwen3-235b-a22b\",\"message\":\"你好\",\"stream\":true}'"
ssh dev "curl -s -H 'Authorization: Bearer $TOKEN' \
'http://localhost:8002/api/chat/stream-status/{conv_id}'"
ssh dev "curl -s -H 'Authorization: Bearer $TOKEN' \
-X POST 'http://localhost:8002/api/chat/stop/{conv_id}?message_id={msg_id}'"
ssh dev "curl -s -H 'Authorization: Bearer $TOKEN' \
'http://localhost:8002/api/chat/conversations?page=1&page_size=5'"
ssh dev "curl -s -H 'Authorization: Bearer $TOKEN' \
'http://localhost:8002/api/chat/conversations/{conv_id}'"
# 1. 发消息,读 3 秒后断开
RESPONSE=$(ssh dev "timeout 3 curl -s -N \
-H 'Authorization: Bearer $TOKEN' \
-H 'Content-Type: application/json' \
-X POST http://localhost:8002/api/chat/send \
-d '{\"model_id\":\"qwen3-235b-a22b\",\"message\":\"说一个字\",\"stream\":true}' 2>&1 || true")
# 2. 提取 IDs
CONV_ID=$(echo "$RESPONSE" | python3 -c "import sys,json
for l in sys.stdin:
if 'conversation_id' in l and 'data:' in l:
print(json.loads(l.split('data: ')[1])['conversation_id']); break" 2>/dev/null)
MSG_ID=$(echo "$RESPONSE" | python3 -c "import sys,json
for l in sys.stdin:
if 'data:' in l and '\"id\"' in l:
print(json.loads(l.split('data: ')[1])['id']); break" 2>/dev/null)
echo "conv=$CONV_ID msg=$MSG_ID"
# 3. 检查 stream-status(应为 streaming)
ssh dev "curl -s -H 'Authorization: Bearer $TOKEN' \
'http://localhost:8002/api/chat/stream-status/$CONV_ID'"
# 4. 发 stop
ssh dev "curl -s -H 'Authorization: Bearer $TOKEN' \
-X POST 'http://localhost:8002/api/chat/stop/$CONV_ID?message_id=$MSG_ID'"
# 5. 验证状态变为 cancelled
sleep 1
ssh dev "curl -s -H 'Authorization: Bearer $TOKEN' \
'http://localhost:8002/api/chat/stream-status/$CONV_ID'"
# 6. 检查 Redis
ssh dev "docker exec middleware-redis redis-cli hgetall 'stream:meta:$CONV_ID'"
ssh dev 在服务器本地执行(localhost:8002)timeout N curl 用于限制流式读取时间