SPB Git

Repository Public

create.md 8.6 KB 388 lines markdown

1---2title: Create a Dream3url: https://platform.claude.com/docs/en/api/beta/dreams/create4---56# Create a Dream78**POST** `/v1/dreams`910Create a Dream1112## Headers1314- `"anthropic-beta": optional array of AnthropicBeta`1516  Optional header to specify the beta version(s) you want to use.1718  - `string`1920  - `"message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 43 more`2122    - `"message-batches-2024-09-24"`2324    - `"prompt-caching-2024-07-31"`2526    - `"computer-use-2024-10-22"`2728    - `"computer-use-2025-01-24"`2930    - `"pdfs-2024-09-25"`3132    - `"token-counting-2024-11-01"`3334    - `"token-efficient-tools-2025-02-19"`3536    - `"output-128k-2025-02-19"`3738    - `"files-api-2025-04-14"`3940    - `"mcp-client-2025-04-04"`4142    - `"mcp-client-2025-11-20"`4344    - `"dev-full-thinking-2025-05-14"`4546    - `"interleaved-thinking-2025-05-14"`4748    - `"code-execution-2025-05-22"`4950    - `"extended-cache-ttl-2025-04-11"`5152    - `"context-1m-2025-08-07"`5354    - `"context-management-2025-06-27"`5556    - `"model-context-window-exceeded-2025-08-26"`5758    - `"skills-2025-10-02"`5960    - `"fast-mode-2026-02-01"`6162    - `"output-300k-2026-03-24"`6364    - `"user-profiles-2026-03-24"`6566    - `"user-profiles-2026-08-18"`6768    - `"user-profiles-2026-09-04"`6970    - `"advisor-tool-2026-03-01"`7172    - `"managed-agents-2026-04-01"`7374    - `"cache-diagnosis-2026-04-07"`7576    - `"dreaming-2026-04-21"`7778    - `"thinking-token-count-2026-05-13"`7980    - `"server-side-fallback-2026-06-01"`8182    - `"server-side-fallback-2026-07-01"`8384    - `"fallback-credit-2026-06-01"`8586    - `"fallback-credit-2026-07-01"`8788    - `"agent-memory-2026-07-22"`8990    - `"mid-conversation-tool-changes-2026-07-01"`9192    - `"compact-2026-01-12"`9394    - `"computer-use-2025-11-24"`9596    - `"mcp-tunnels-2026-06-22"`9798    - `"structured-outputs-2025-11-13"`99100    - `"task-budgets-2026-03-13"`101102    - `"thinking-display-updates-2026-08-18"`103104    - `"ce-user-management-2026-07-13"`105106    - `"mid-conversation-output-config-2026-07-01"`107108    - `"thinking-binding-controls-2026-08-01"`109110    - `"mid-conversation-system-clear-at-2026-08-21"`111112    - `"compact-2026-09-04"`113114- `"anthropic-workspace-id": optional string`115116## Body parameters117118- `inputs: array of BetaDreamInput`119120  - `BetaDreamMemoryStoreInput object`121122    An input memory store the dream reads from. The dream never mutates this store unless it is also the destination: with output_behavior {type: "update_existing"} the job consolidates this store in place.123124    - `type: "memory_store"`125126    - `memory_store_id: string`127128      minLength: 1129130  - `BetaDreamSessionsInput object`131132    Input session transcripts the dream reads.133134    - `type: "sessions"`135136    - `session_ids: array of string`137138- `model: string or BetaDreamModelConfigParam`139140  - `string`141142  - `BetaDreamModelConfigParam object`143144    Model identifier and configuration applied to every pipeline stage.145146    - `id: string`147148      Model identifier, e.g. "claude-opus-5". 1-256 characters.149150      minLength: 1, maxLength: 256151152    - `speed: optional "standard" or "fast" or null`153154      Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time.155156      - `"standard"`157158      - `"fast"`159160- `instructions: optional string or null`161162  minLength: 1, maxLength: 4096163164- `output_behavior: optional BetaOutputBehavior`165166  - `BetaOutputBehaviorCreateNew object`167168    The default destination: the job creates a new output memory store as a clone of the memory_store input and writes the consolidated memories into it. The input store is never mutated.169170    - `type: "create_new"`171172  - `BetaOutputBehaviorUpdateExisting object`173174    The job writes the consolidated memories into this existing memory store instead of creating one. In EAP the store must be the job's own memory_store input, so the job consolidates the store in place.175176    - `type: "update_existing"`177178    - `memory_store_id: string`179180      minLength: 1181182## Returns183184- `BetaDream object`185186  An asynchronous memory-consolidation job that reads a memory store plus a set of session transcripts and writes consolidated memories into an output memory store — a new store by default, or an existing store chosen via output_behavior. The Dreams API is in research preview: the request and response shapes are volatile and may change without the deprecation period that applies to generally-available endpoints.187188  - `type: "dream"`189190  - `id: string`191192  - `archived_at: string or null`193194    A timestamp in RFC 3339 format195196    format: date-time197198  - `created_at: string`199200    A timestamp in RFC 3339 format201202    format: date-time203204  - `ended_at: string or null`205206    A timestamp in RFC 3339 format207208    format: date-time209210  - `error: BetaDreamError or null`211212    Failure detail for a Dream whose `status` is `failed`.213214    - `type: string`215216    - `message: string`217218  - `inputs: array of BetaDreamInput`219220    - `BetaDreamMemoryStoreInput object`221222      An input memory store the dream reads from. The dream never mutates this store unless it is also the destination: with output_behavior {type: "update_existing"} the job consolidates this store in place.223224      - `type: "memory_store"`225226      - `memory_store_id: string`227228        minLength: 1229230    - `BetaDreamSessionsInput object`231232      Input session transcripts the dream reads.233234      - `type: "sessions"`235236      - `session_ids: array of string`237238  - `instructions: string or null`239240  - `model: BetaDreamModelConfig`241242    Model identifier and configuration applied to every pipeline stage. Same wire shape as the Agents API ModelConfig.243244    - `id: string`245246      Model identifier, e.g. "claude-opus-5". 1-256 characters.247248      minLength: 1, maxLength: 256249250    - `speed: optional "standard" or "fast"`251252      Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time.253254      - `"standard"`255256      - `"fast"`257258  - `output_behavior: BetaOutputBehavior`259260    - `BetaOutputBehaviorCreateNew object`261262      The default destination: the job creates a new output memory store as a clone of the memory_store input and writes the consolidated memories into it. The input store is never mutated.263264      - `type: "create_new"`265266    - `BetaOutputBehaviorUpdateExisting object`267268      The job writes the consolidated memories into this existing memory store instead of creating one. In EAP the store must be the job's own memory_store input, so the job consolidates the store in place.269270      - `type: "update_existing"`271272      - `memory_store_id: string`273274        minLength: 1275276  - `outputs: array of BetaDreamOutput`277278    - `type: "memory_store"`279280    - `memory_store_id: string`281282  - `session_id: string or null`283284  - `status: BetaDreamStatus`285286    Lifecycle status of a Dream.287288    - `"pending"`289290    - `"running"`291292    - `"completed"`293294    - `"failed"`295296    - `"canceled"`297298  - `usage: BetaDreamUsage`299300    Cumulative token usage for the dream across every pipeline stage.301302    - `cache_creation_input_tokens: number`303304      Total tokens used to create prompt-cache entries (sum of all TTL tiers).305306      format: int32307308    - `cache_read_input_tokens: number`309310      Total tokens read from prompt cache.311312      format: int32313314    - `input_tokens: number`315316      Total uncached input tokens consumed across every pipeline stage.317318      format: int32319320    - `output_tokens: number`321322      Total output tokens generated across every pipeline stage.323324      format: int32325326## Example327328```bash329curl https://api.anthropic.com/v1/dreams \330    -H 'Content-Type: application/json' \331    -H 'anthropic-version: 2023-06-01' \332    -H 'anthropic-beta: dreaming-2026-04-21' \333    -H "X-Api-Key: $ANTHROPIC_API_KEY" \334    -d '{335          "inputs": [336            {337              "memory_store_id": "x",338              "type": "memory_store"339            }340          ],341          "model": "string"342        }'343```344345### Response (200)346347```json348{349  "id": "id",350  "archived_at": "2019-12-27T18:11:19.117Z",351  "created_at": "2019-12-27T18:11:19.117Z",352  "ended_at": "2019-12-27T18:11:19.117Z",353  "error": {354    "message": "message",355    "type": "type"356  },357  "inputs": [358    {359      "memory_store_id": "x",360      "type": "memory_store"361    }362  ],363  "instructions": "instructions",364  "model": {365    "id": "x",366    "speed": "standard"367  },368  "output_behavior": {369    "type": "create_new"370  },371  "outputs": [372    {373      "memory_store_id": "memory_store_id",374      "type": "memory_store"375    }376  ],377  "session_id": "session_id",378  "status": "pending",379  "type": "dream",380  "usage": {381    "cache_creation_input_tokens": 0,382    "cache_read_input_tokens": 0,383    "input_tokens": 0,384    "output_tokens": 0385  }386}387```388
Files main
Menu

Theme