觸發一次非同步記憶整理任務。
POST /api/v1/cloud/dreams
建立一個 Dream,系統將非同步整理指定的 Memory Store。返回 Dream 對象。
要求標頭
頭部 | 必選 | 說明 |
| 是 |
|
| 是 |
|
請求體
欄位 | 類型 | 必選 | 說明 |
| array | 是 | 輸入列表。必須包含一個 |
| string | 否 | 模型選擇: |
| string | 否 | 自訂整理指令,最長 4096 字元。 |
inputs 元素
欄位 | 類型 | 說明 |
| string |
|
| string | 當 type 為 |
| array | 當 type 為 |
樣本請求
curl -s -X POST 'https://api.qoder.com.cn/api/v1/cloud/dreams' \
-H "Authorization: Bearer $QODER_PAT" \
-H "Content-Type: application/json" \
-d '{
"inputs": [
{ "type": "memory_store", "memory_store_id": "memstore_019e5cdb9c3f71c3b6505eba937a40b4" },
{ "type": "sessions", "session_ids": ["sess_019e7a1b2c3d4e5f6a7b8c9d0e1f2a3b"] }
],
"model": "auto",
"instructions": "重點關注使用者對代碼風格的偏好修正"
}'
樣本響應
HTTP 201 Created
{
"id": "drm_019e86b4a8f070a3b6c5d4e3f2a1b0c9",
"type": "dream",
"status": "pending",
"inputs": [
{ "type": "memory_store", "memory_store_id": "memstore_019e5cdb9c3f71c3b6505eba937a40b4" },
{ "type": "sessions", "session_ids": ["sess_019e7a1b2c3d4e5f6a7b8c9d0e1f2a3b"] }
],
"outputs": [],
"model": { "id": "auto" },
"instructions": "重點關注使用者對代碼風格的偏好修正",
"session_id": null,
"usage": { "input_tokens": 0, "output_tokens": 0, "cache_creation_input_tokens": 0, "cache_read_input_tokens": 0 },
"error": null,
"created_at": "2026-06-15T10:00:00Z",
"ended_at": null,
"archived_at": null
}
錯誤碼
HTTP | Type | 觸發條件 |
400 |
| inputs 為空白、缺少 memory_store 輸入、重複 memory_store、sessions 超過 100 個、model 不在允許清單、instructions 超長。 |
401 |
| 缺少或無效的認證令牌。 |
404 |
| memory_store_id 引用的 Memory Store 不存在或不可訪問。 |
409 |
| 使用者已有一個活躍的 Dream(pending 或 running)。 |
完整錯誤信封說明詳見錯誤參考。