API 參考

Seeknetic API 文檔

使用 Seeknetic 雲端 API 生成 embeddings 與 tags、管理集合,並完成語義檢索工作流。

認證 X-API-Key
格式 application/json

For production integration, we strongly recommend using the official SDKs first, then fallback to direct HTTP APIs when needed.

API 區域端點

區域 基礎 URL 狀態
日本東京 https://api.seeknetic.com 可用
美國俄勒岡州 https://api.us.seeknetic.com 即將推出
中國北京 https://api.cn.seeknetic.com 即將推出

認證

所有模型服務端點都需要 API 密鑰認證。

使用 API 密鑰

你可以透過以下兩種方式提供 API 密鑰:

方式 1:X-API-Key 頭(推薦)

curl https://api.seeknetic.com/video_tagging \
  -H "X-API-Key: {your_api_key}" \
  -H "Content-Type: application/json"

方式 2:Authorization 頭

curl https://api.seeknetic.com/video_tagging \
  -H "Authorization: Bearer {your_api_key}" \
  -H "Content-Type: application/json"

File Upload

/files/upload/tensors is a standalone upload API. It is not part of embedding or tagging endpoints.

POST /files/upload/tensors

Upload preprocessed tensor JSON (embedding/tagging) and get r2_keys for later async API calls.

請求 curl
鑑權
X-API-Key or Authorization: Bearer
Content-Type
application/json
請求體
{"service","video_input/audio_input/video_kwargs","request_id"}
bash
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())

視頻 Embedding

將視頻或文本編碼為向量表示,用於語義搜索和相似度計算。

If you use tensor mode here, first upload tensor payloads via /files/upload/tensors.

POST /video_embedding/encode_text

將文本編碼為 embedding 向量,用於語義搜索。

使用此端點創建可與視頻 embedding 比較的查詢 embedding。

請求 curl
鑑權
X-API-Key
Content-Type
application/json
請求體
{"text":"..."}
bash
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'])}")
POST /video_embedding/encode_video/async

提交視頻進行異步 embedding 提取。

Also supports tensor mode: tensor.video_input_key / tensor.audio_input_key (from /files/upload/tensors).

請求 curl
鑑權
X-API-Key
Content-Type
application/json
請求體
{"video_url":"https://..."}
bash
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)
GET /async_status/{request_id}

查詢異步任務的狀態和結果。

請求 curl
鑑權
X-API-Key
路徑參數
request_id
狀態流轉:
pending
processing
completed
bash
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']}")

視頻 Tagging

分析視頻的鏡頭大小、攝像機運動、拍攝角度等元數據信息。

POST /video_tagging/async

提交視頻進行異步標簽提取。

Also supports tensor mode: tensor.video_input_key / tensor.video_kwargs_key (from /files/upload/tensors).

請求 curl
鑑權
X-API-Key
Content-Type
application/json
請求體
{"video_url":"https://..."}
bash
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}")
GET /async_status/{request_id}

Check tagging async task status by request ID. Returns the same status schema as embedding async status.

請求 curl
鑑權
X-API-Key
路徑參數
request_id
bash
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 請求參數錯誤 檢查請求 JSON 格式和必需字段
401 API 密鑰無效 檢查 API 密鑰是否正確
402 Quota exceeded Check usage and billing status, then retry with available quota.
413 Payload too large Reduce request size or upload tensors in smaller chunks.
422 Validation error Verify required fields and schema format based on OpenAPI request model.
429 超過速率限制 降低請求頻率或升級計劃
500 服務器內部錯誤 聯繫技術支持
502 外部 API 錯誤 外部服務暫時不可用,稍後重試
504 請求超時 嘗試使用異步接口或更小的視頻

速率限制

  • 每個 API 密鑰都有獨立的速率限制(QPS - 每秒查詢數)
  • 速率限制在創建 API 密鑰時設置
  • 超出限制將返回 429 錯誤