用影片智能 建立應用程式。
已公開的 Seeknetic API 支持文字嵌入、異步影片嵌入、張量上傳與專業鏡頭標注。
身份驗證
在 X-API-Key 請求頭中提供 API Key。可在 Seeknetic 賬戶中創建或管理金鑰。
已發佈 API 亦支援 Authorization: Bearer <API_KEY>,可替代 X-API-Key;每個請求選擇一種驗證方式。
基礎 URL: https://api.seeknetic.com
程式碼、API 標識符和請求值保留原有技術語言。
文字嵌入
將文字查詢編碼為嵌入向量,與已索引媒體進行語義比較。
POST
/video_embedding/encode_text cURL
curl -X POST "https://api.seeknetic.com/video_embedding/encode_text" \
-H "X-API-Key: {your_api_key}" \
-H "Content-Type: application/json" \
-d '{"text":"A dog playing in the park"}' Python / 示例
Python
import requests
response = requests.post(
"https://api.seeknetic.com/video_embedding/encode_text",
headers={
"X-API-Key": "{your_api_key}",
"Content-Type": "application/json"
},
json={"text": "A dog playing in the park"}
)
result = response.json()
print(f"Text embedding dimension: {len(result['embedding'])}") 影片嵌入
提交托管影片進行異步編碼。保存返回的 request_id,再輪詢結果。
使用預處理輸入時,請引用張量上載介面傳回的 tensor.video_input_key 和 tensor.audio_input_key。
POST
/video_embedding/encode_video/async cURL
curl -X POST "https://api.seeknetic.com/video_embedding/encode_video/async" \
-H "X-API-Key: {your_api_key}" \
-H "Content-Type: application/json" \
-d '{"video_url":"https://example.com/video.mp4"}' Python / 示例
Python
import requests
import time
# 1. Submit async task
response = requests.post(
"https://api.seeknetic.com/video_embedding/encode_video/async",
headers={
"X-API-Key": "{your_api_key}",
"Content-Type": "application/json"
},
json={"video_url": "https://example.com/video.mp4"}
)
request_id = response.json()["request_id"]
print(f"Task submitted, Request ID: {request_id}")
# 2. Poll status until completion
while True:
status_response = requests.get(
f"https://api.seeknetic.com/async_status/{request_id}",
headers={"X-API-Key": "{your_api_key}"}
)
status_data = status_response.json()
status = status_data['status']
if status == 'completed':
embedding = status_data['embedding']
print(f"Complete! Dimension: {len(embedding)}")
break
elif status == 'failed':
print(f"Failed: {status_data['error_message']}")
break
time.sleep(2) 張量上傳
上傳預處理的影片與音訊張量,然後在異步模型請求中引用返回的輸入鍵。
POST
/files/upload/tensors cURL
curl -X POST "https://api.seeknetic.com/files/upload/tensors" \
-H "X-API-Key: {your_api_key}" \
-H "Content-Type: application/json" \
-d '{
"service":"embedding",
"request_id":"emb-task-0001",
"video_input":{"data":"AAAB...","shape":[1,12,3,224,224],"dtype":"uint8"},
"audio_input":{"data":"AAAB...","shape":[1,1,220500],"dtype":"float32"}
}' Python / 示例
Python
import requests
response = requests.post(
"https://api.seeknetic.com/files/upload/tensors",
headers={
"X-API-Key": "{your_api_key}",
"Content-Type": "application/json"
},
json={
"service": "embedding",
"request_id": "emb-task-0001",
"video_input": {
"data": "AAAB...",
"shape": [1, 12, 3, 224, 224],
"dtype": "uint8"
},
"audio_input": {
"data": "AAAB...",
"shape": [1, 1, 220500],
"dtype": "float32"
}
}
)
print(response.json()) 鏡頭標注
提交影片,異步生成專業鏡頭元資料。
使用預處理標註輸入時,請引用張量上載介面傳回的 tensor.video_input_key 和 tensor.video_kwargs_key。
POST
/video_tagging/async cURL
curl -X POST "https://api.seeknetic.com/video_tagging/async" \
-H "X-API-Key: {your_api_key}" \
-H "Content-Type: application/json" \
-d '{"video_url":"https://example.com/video.mp4"}' Python / 示例
Python
import requests
# Submit async tagging task
response = requests.post(
"https://api.seeknetic.com/video_tagging/async",
headers={
"X-API-Key": "{your_api_key}",
"Content-Type": "application/json"
},
json={"video_url": "https://example.com/video.mp4"}
)
request_id = response.json()["request_id"]
print(f"Tagging task submitted, Request ID: {request_id}") 異步任務狀態
查詢已提交的請求。等待或處理中時繼續輪詢,完成後查看結果。
任務狀態:pending → processing → completed。失敗任務會傳回 error_message。
GET
/async_status/{request_id} cURL
curl -X GET "https://api.seeknetic.com/async_status/{request_id}" \
-H "X-API-Key: {your_api_key}" Python / 示例
Python
import requests
request_id = "your_request_id_from_async_call"
response = requests.get(
f"https://api.seeknetic.com/async_status/{request_id}",
headers={"X-API-Key": "{your_api_key}"}
)
status_data = response.json()
print(f"Status: {status_data['status']}")
if status_data['status'] == 'completed':
print(f"Result: {status_data['embedding']}") 錯誤與重試
400 回應請檢查輸入參數,401 請檢查金鑰。429 後降低請求頻率。臨時服務端錯誤可採用有次數限制的重試策略。
| HTTP 狀態碼 | 說明 | 處理方式 |
|---|---|---|
| 400 | 請求參數錯誤 | 檢查 JSON 格式和必要欄位。 |
| 401 | 驗證失敗 | 檢查 API Key,避免將密鑰暴露於前端程式碼。 |
| 402 | 額度不足 | 檢查用量與帳單,待額度恢復後重試。 |
| 413 | 請求內容過大 | 縮小請求內容,或分批上傳較小的 tensors。 |
| 422 | 參數驗證失敗 | 檢查欄位類型和對應接口的請求結構。 |
| 429 | 超過速率限制 | 降低請求頻率,延遲後重試。 |
| 500 | 服務內部錯誤 | 設定重試次數上限;持續失敗時聯絡支援。 |
| 502 | 上游服務錯誤 | 等待後重試,並設定次數上限。 |
| 504 | 請求逾時 | 使用非同步工作流程或較小的輸入;重新提交前先查詢任務狀態。 |
速率限制
每個 API Key 有獨立的 QPS(每秒請求數)限制,在建立密鑰時設定;超過限制返回 HTTP 429。