翻译进行中此页面的中文翻译即将推出。目前请参考 英文版本。
您的第一个 API 调用
Shannon 的基本工作流程很简单:提交任务、获取任务 ID、检查状态并检索结果。完整示例 (cURL)
更多示例
完整文档请参考 英文版本。下一步
完整 API 参考
所有端点的完整文档
智能体目录
预构建的特定任务智能体
Python SDK
官方 Python 客户端库
流式 API
使用 SSE 实时事件流
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
快速开始使用 Shannon API - 完整的首次 API 调用示例
# 1. 提交任务
RESPONSE=$(curl -sS -X POST http://localhost:8080/api/v1/tasks \
-H "X-API-Key: sk_test_123456" \
-H "Content-Type: application/json" \
-d '{
"query": "法国的首都是什么?"
}')
# 2. 提取任务 ID
TASK_ID=$(echo $RESPONSE | jq -r '.task_id')
echo "任务 ID: $TASK_ID"
# 3. 轮询结果
while true; do
STATUS=$(curl -sS http://localhost:8080/api/v1/tasks/$TASK_ID \
-H "X-API-Key: sk_test_123456")
STATE=$(echo $STATUS | jq -r '.status')
if [ "$STATE" = "TASK_STATUS_COMPLETED" ]; then
echo $STATUS | jq -r '.result'
break
elif [ "$STATE" = "TASK_STATUS_FAILED" ]; then
echo "错误: $(echo $STATUS | jq -r '.error')"
exit 1
fi
sleep 2
done
任务 ID: task_01HQZX3Y9K8M2P4N5S7T9W2V
法国的首都是巴黎。
此页面对您有帮助吗?