Claude Platform Docs

夢境

建立夢境
$client->beta->dreams->create(list<BetaDreamInput> inputs, Model model, ?string instructions, ?BetaOutputBehavior outputBehavior, ?list<AnthropicBeta> betas, ?string workspaceID): BetaDream
POST/v1/dreams
Requires anthropic-beta: dreaming-2026-04-21. How to send beta headers

啟動一個非同步工作,利用過去的工作階段產生記憶儲存區的重新組織版本,並取回夢境以輪詢結果。

列出夢境
$client->beta->dreams->list(?\Datetime createdAtGt, ?\Datetime createdAtLt, ?bool includeArchived, ?int limit, ?string page, ?list<BetaDreamStatus> statuses, ?list<AnthropicBeta> betas, ?string workspaceID): PageCursor<BetaDream>
GET/v1/dreams
Requires anthropic-beta: dreaming-2026-04-21. How to send beta headers

列出工作區中的夢境,最新的在前。

取得夢境
$client->beta->dreams->retrieve(string dreamID, ?list<AnthropicBeta> betas, ?string workspaceID): BetaDream
GET/v1/dreams/{dream_id}
Requires anthropic-beta: dreaming-2026-04-21. How to send beta headers

依 ID 取得夢境,以檢查其狀態、輸出記憶儲存區及權杖用量。

取消夢境
$client->beta->dreams->cancel(string dreamID, ?list<AnthropicBeta> betas, ?string workspaceID): BetaDream
POST/v1/dreams/{dream_id}/cancel
Requires anthropic-beta: dreaming-2026-04-21. How to send beta headers

停止處於 pending 或 running 狀態的夢境。

封存夢境
$client->beta->dreams->archive(string dreamID, ?list<AnthropicBeta> betas, ?string workspaceID): BetaDream
POST/v1/dreams/{dream_id}/archive
Requires anthropic-beta: dreaming-2026-04-21. How to send beta headers

將 completed、failed 或 canceled 的夢境從預設的夢境清單中隱藏。

Models
class BetaDream { $type = 'dream'; $id; $archivedAt; /* 11 more */ }
class BetaDreamError { $type; $message; }
string type

A code for why the dream failed, such as timeout or internal_error.

The Dreams guide lists common error codes and when they occur.

string message

A human-readable explanation of why the dream failed.

One of the following:
class BetaDreamMemoryStoreInput { $type = 'memory_store'; $memoryStoreID; }
"memory_store" type
string memoryStoreID

The ID of the memory store for the dream to read (memstore_...).

The memory store must be in the same workspace as the dream and must not be archived.

class BetaDreamSessionsInput { $type = 'sessions'; $sessionIDs; }
"sessions" type
list<string> sessionIDs

The IDs of the sessions whose transcripts the dream reads (sesn_...).

Give 1 to 100 IDs, with no duplicates. Each session must be in the same workspace as the dream. Responses list the IDs in sorted order.

class BetaDreamMemoryStoreInput { $type = 'memory_store'; $memoryStoreID; }
"memory_store" type
string memoryStoreID

The ID of the memory store for the dream to read (memstore_...).

The memory store must be in the same workspace as the dream and must not be archived.

class BetaDreamMemoryStoreOutput { $type = 'memory_store'; $memoryStoreID; }
"memory_store" type
string memoryStoreID

The ID of the memory store that the dream writes its result to (memstore_...).

With output_behavior set to create_new, this is a new memory store. With update_existing, it is the input memory store.

class BetaDreamModelConfig { $id; $speed; }
string id

The ID of the model that runs the dream, as given in the request that created it.

?Speed speed⁠

How fast the model generates output for the dream. Always standard.

class BetaDreamModelConfigParam { $id; $speed; }
string id

The ID of the model to run the dream with.

The ID can be 1 to 256 characters long.

The Availability section of the Dreams guide lists the supported models.

?Speed speed

How fast the model generates output for the dream. Defaults to standard.

Dreams accept only standard.

class BetaDreamOutput { $type = 'memory_store'; $memoryStoreID; }
"memory_store" type
string memoryStoreID

The ID of the memory store that the dream writes its result to (memstore_...).

With output_behavior set to create_new, this is a new memory store. With update_existing, it is the input memory store.

class BetaDreamSessionsInput { $type = 'sessions'; $sessionIDs; }
"sessions" type
list<string> sessionIDs

The IDs of the sessions whose transcripts the dream reads (sesn_...).

Give 1 to 100 IDs, with no duplicates. Each session must be in the same workspace as the dream. Responses list the IDs in sorted order.

One of the following:
"pending"

The dream is waiting to start and hasn't read its inputs yet.

outputs is empty and every usage count is zero.

"running"

The dream is reading its inputs and writing its result.

usage updates while the dream has this status.

"completed"

The dream finished and its output memory store holds the complete result.

"failed"

The dream stopped with an error, which error describes.

If outputs references a memory store, that memory store keeps what the dream wrote before it stopped.

"canceled"

A cancel request stopped the dream before it reached completed or failed.

If outputs references a memory store, that memory store keeps what the dream wrote. usage can keep changing after the cancel.

class BetaDreamUsage { $cacheCreationInputTokens; $cacheReadInputTokens; $inputTokens; $outputTokens; }
int cacheCreationInputTokens

The dream's input tokens that were written to the prompt cache, for both the 5-minute and 1-hour cache durations.

int cacheReadInputTokens

The dream's input tokens that were read from the prompt cache.

int inputTokens

The dream's input tokens that weren't read from or written to the prompt cache.

int outputTokens

The tokens that the model generated for the dream.

One of the following:
One of the following:
class BetaOutputBehaviorCreateNew { $type = 'create_new'; }
"create_new" type
class BetaOutputBehaviorUpdateExisting { $type = 'update_existing'; $memoryStoreID; }
"update_existing" type
string memoryStoreID

The ID of the memory store for the dream to write its result to (memstore_...). It must be the memory store in the memory_store entry of inputs.

class BetaOutputBehaviorCreateNew { $type = 'create_new'; }
"create_new" type
class BetaOutputBehaviorUpdateExisting { $type = 'update_existing'; $memoryStoreID; }
"update_existing" type
string memoryStoreID

The ID of the memory store for the dream to write its result to (memstore_...). It must be the memory store in the memory_store entry of inputs.

class BetaTargetStoreHeldError { $type = 'conflict_error'; $message; }
"conflict_error" type
?string message

A human-readable explanation of why the memory store can't be used yet, with the ID of the dream that is using it when the server can identify it.