Claude Platform Docs

Buat Dream

$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

Memulai pekerjaan asinkron yang menggunakan sesi-sesi sebelumnya untuk menghasilkan versi memory store yang telah ditata ulang, lalu mengembalikan dream yang dapat Anda poll untuk mendapatkan hasilnya.

Secara default, dream menulis hasilnya ke memory store baru dan tidak mengubah memory store input. Respons memiliki status yang diatur ke pending dan array outputs yang kosong. Lakukan polling pada dream hingga status bernilai completed, failed, atau canceled.

Lihat panduan Dreams untuk mempelajari lebih lanjut tentang cara membuat dream.

Parameters
inputs: list<BetaDreamInput>

The memory store and sessions for the dream to read, as exactly one memory_store entry and exactly one sessions entry.

model: Model

The model that runs a dream, given as a model ID or as an object with id and speed.

In the object form, speed can only be standard.

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

instructions?: optional string

Guidance that steers how the dream reads the sessions and organizes the output memory store, from 1 to 4,096 characters.

See the Dreams guide for what kinds of instructions work well.

outputBehavior?: optional BetaOutputBehavior

Which memory store a dream writes its result to. Defaults to create_new when left out of a create request.

betas?: optional list<AnthropicBeta>⁠Header parameter

This endpoint is in beta: requests must send dreaming-2026-04-21 in this header.

workspaceID?: optional string⁠Header parameter

Optional header to select the Workspace for this request. The value is a Workspace ID (for example, wrkspc_011CZkZaBF1tNoB5wlCeusgy).

Only needed for credentials that can act on more than one Workspace. A credential that belongs to a specific Workspace may omit it; if sent, it must match that Workspace.

Returns
class BetaDream { $type = 'dream'; $id; $archivedAt; /* 11 more */ }
Buat Dream
<?php

require_once dirname(__DIR__) . '/vendor/autoload.php';

use Anthropic\Client;
use Anthropic\Beta\AnthropicBeta;

$client = new Client(apiKey: 'my-anthropic-api-key');

$betaDream = $client->beta->dreams->create(
  inputs: [['memoryStoreID' => 'x', 'type' => 'memory_store']],
  model: 'string',
  instructions: 'x',
  outputBehavior: ['type' => 'create_new'],
  betas: [AnthropicBeta::MESSAGE_BATCHES_2024_09_24],
  workspaceID: 'wrkspc_011CZkZaBF1tNoB5wlCeusgy',
);

var_dump($betaDream);
Returns Examples
Response 200
{
  "id": "id",
  "archived_at": "2019-12-27T18:11:19.117Z",
  "created_at": "2019-12-27T18:11:19.117Z",
  "ended_at": "2019-12-27T18:11:19.117Z",
  "error": {
    "message": "message",
    "type": "type"
  },
  "inputs": [
    {
      "memory_store_id": "x",
      "type": "memory_store"
    }
  ],
  "instructions": "instructions",
  "model": {
    "id": "x",
    "speed": "standard"
  },
  "output_behavior": {
    "type": "create_new"
  },
  "outputs": [
    {
      "memory_store_id": "memory_store_id",
      "type": "memory_store"
    }
  ],
  "session_id": "session_id",
  "status": "pending",
  "type": "dream",
  "usage": {
    "cache_creation_input_tokens": 0,
    "cache_read_input_tokens": 0,
    "input_tokens": 0,
    "output_tokens": 0
  }
}