API 參考概覽
Vecstruct REST API 讓你直接用 HTTP 呼叫所有功能,不依賴任何 SDK。
Base URL
https://api.vecstruct.com/v1
認證
所有請求都需要在 Header 帶入 Bearer Token:
Authorization: Bearer sk-your-api-key
回應格式
所有 API 回應的 JSON 結構如下:
{
"success": true,
"code": 0,
"message": "OK",
"data": { ... }
}
| 欄位 | 類型 | 說明 |
|---|---|---|
success | boolean | 請求是否成功 |
code | number | 業務錯誤碼(0 代表成功) |
message | string | 狀態描述或錯誤訊息 |
data | object / array | 回應的資料主體 |
分頁
列表型 API 回傳分頁結構:
{
"items": [...],
"pagination": {
"page": 1,
"per_page": 20,
"total_items": 150,
"total_pages": 8
}
}
常見錯誤碼
| HTTP | Code | 說明 |
|---|---|---|
| 400 | 2xxx | 請求參數錯誤 |
| 401 | 1100 | API Key 缺失或無效 |
| 402 | 1200 | 餘額或配額不足 |
| 403 | 1300 | 權限不足 |
| 404 | 3xxx | 資源不存在 |
| 429 | 1003 | 速率限制 |
| 500 | 9xxx | 伺服器錯誤 |
API 端點清單
| 類別 | 端點 |
|---|---|
| 認證 | GET /v1/auth/me |
| Chat Completions | POST /v1/chat/completions |
| Embeddings | POST /v1/embeddings |
| Rerank | POST /v1/rerank |
| Models | GET /v1/models |
| RAG 查詢 | POST /v1/rag/query |
| Memory | GET/POST/DELETE /v1/memories |
| Documents | GET/POST/DELETE /v1/documents |
| Audit Logs | GET /v1/audit/logs |