Skip to content

Commit cad1be2

Browse files
feat(api): add support for claude-fable-5-1 and claude-mythos-5-1
Also adds per-message `output_config` (effort) and `clear_at` on system messages, and the thinking-block binding controls (beta). Stainless-Generated-From: 17a4469d9e7162b583cd8cba86cd66660eed3dad
1 parent f013779 commit cad1be2

22 files changed

Lines changed: 969 additions & 29 deletions

scripts/mock-spec.json.gz

1.98 KB
Binary file not shown.

src/Beta/Agents/BetaManagedAgentsModel.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
*/
1212
enum BetaManagedAgentsModel: string
1313
{
14+
case CLAUDE_FABLE_5_1 = 'claude-fable-5-1';
15+
1416
case CLAUDE_SONNET_5 = 'claude-sonnet-5';
1517

1618
case CLAUDE_FABLE_5 = 'claude-fable-5';

src/Beta/AnthropicBeta.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,4 +87,10 @@ enum AnthropicBeta: string
8787
case THINKING_DISPLAY_UPDATES_2026_08_18 = 'thinking-display-updates-2026-08-18';
8888

8989
case CE_USER_MANAGEMENT_2026_07_13 = 'ce-user-management-2026-07-13';
90+
91+
case MID_CONVERSATION_OUTPUT_CONFIG_2026_07_01 = 'mid-conversation-output-config-2026-07-01';
92+
93+
case THINKING_BINDING_CONTROLS_2026_08_01 = 'thinking-binding-controls-2026-08-01';
94+
95+
case MID_CONVERSATION_SYSTEM_CLEAR_AT_2026_08_21 = 'mid-conversation-system-clear-at-2026-08-21';
9096
}

src/Beta/Messages/BetaMessage.php

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace Anthropic\Beta\Messages;
66

7+
use Anthropic\Core\Attributes\Optional;
78
use Anthropic\Core\Attributes\Required;
89
use Anthropic\Core\Concerns\SdkModel;
910
use Anthropic\Core\Contracts\BaseModel;
@@ -18,6 +19,7 @@
1819
* @phpstan-import-type BetaDiagnosticsShape from \Anthropic\Beta\Messages\BetaDiagnostics
1920
* @phpstan-import-type BetaRefusalStopDetailsShape from \Anthropic\Beta\Messages\BetaRefusalStopDetails
2021
* @phpstan-import-type BetaUsageShape from \Anthropic\Beta\Messages\BetaUsage
22+
* @phpstan-import-type BetaThinkingDroppedInputTransformationShape from \Anthropic\Beta\Messages\BetaThinkingDroppedInputTransformation
2123
*
2224
* @phpstan-type BetaMessageShape = array{
2325
* id: string,
@@ -32,6 +34,7 @@
3234
* stopSequence: string|null,
3335
* type: 'message',
3436
* usage: BetaUsage|BetaUsageShape,
37+
* inputTransformations?: list<BetaThinkingDroppedInputTransformation|BetaThinkingDroppedInputTransformationShape>|null,
3538
* }
3639
*/
3740
final class BetaMessage implements BaseModel
@@ -177,6 +180,32 @@ final class BetaMessage implements BaseModel
177180
#[Required]
178181
public BetaUsage $usage;
179182

183+
/**
184+
* Changes the API made to the request's input before showing it to the model:
185+
* one entry per change, in request order. Today the only entry type is
186+
* `thinking_dropped` — a `thinking`, `redacted_thinking` or `connector_text`
187+
* block from the request's `messages` that was removed from the prompt instead
188+
* of being shown to the model because it failed a binding check. More entry
189+
* types may be added over time; ignore types you do not recognize.
190+
*
191+
* Requires `anthropic-beta: thinking-binding-controls-2026-08-01`. Present on
192+
* every such response from a model that supports extended thinking, as `[]`
193+
* when nothing was changed; without the beta, blocks are removed all the same
194+
* but nothing is reported. Removed blocks contribute nothing to
195+
* `usage.input_tokens`. When streaming, the array is final in `message_start`;
196+
* the final `message_delta` event carries it only when a server-side model
197+
* fallback happened mid-stream, in which case it holds the serving model's
198+
* entries and replaces the one in `message_start`.
199+
*
200+
* @var list<BetaThinkingDroppedInputTransformation>|null $inputTransformations
201+
*/
202+
#[Optional(
203+
'input_transformations',
204+
list: BetaThinkingDroppedInputTransformation::class,
205+
nullable: true,
206+
)]
207+
public ?array $inputTransformations;
208+
180209
/**
181210
* `new BetaMessage()` is missing required properties by the API.
182211
*
@@ -250,6 +279,7 @@ public function parsedOutput(): mixed
250279
* @param BetaRefusalStopDetails|BetaRefusalStopDetailsShape|null $stopDetails
251280
* @param BetaStopReason|value-of<BetaStopReason>|null $stopReason
252281
* @param BetaUsage|BetaUsageShape $usage
282+
* @param list<BetaThinkingDroppedInputTransformation|BetaThinkingDroppedInputTransformationShape>|null $inputTransformations
253283
*/
254284
public static function with(
255285
string $id,
@@ -262,6 +292,7 @@ public static function with(
262292
BetaStopReason|string|null $stopReason,
263293
?string $stopSequence,
264294
BetaUsage|array $usage,
295+
?array $inputTransformations = null,
265296
): self {
266297
$self = new self;
267298

@@ -276,6 +307,8 @@ public static function with(
276307
$self['stopSequence'] = $stopSequence;
277308
$self['usage'] = $usage;
278309

310+
null !== $inputTransformations && $self['inputTransformations'] = $inputTransformations;
311+
279312
return $self;
280313
}
281314

@@ -489,4 +522,31 @@ public function withUsage(BetaUsage|array $usage): self
489522

490523
return $self;
491524
}
525+
526+
/**
527+
* Changes the API made to the request's input before showing it to the model:
528+
* one entry per change, in request order. Today the only entry type is
529+
* `thinking_dropped` — a `thinking`, `redacted_thinking` or `connector_text`
530+
* block from the request's `messages` that was removed from the prompt instead
531+
* of being shown to the model because it failed a binding check. More entry
532+
* types may be added over time; ignore types you do not recognize.
533+
*
534+
* Requires `anthropic-beta: thinking-binding-controls-2026-08-01`. Present on
535+
* every such response from a model that supports extended thinking, as `[]`
536+
* when nothing was changed; without the beta, blocks are removed all the same
537+
* but nothing is reported. Removed blocks contribute nothing to
538+
* `usage.input_tokens`. When streaming, the array is final in `message_start`;
539+
* the final `message_delta` event carries it only when a server-side model
540+
* fallback happened mid-stream, in which case it holds the serving model's
541+
* entries and replaces the one in `message_start`.
542+
*
543+
* @param list<BetaThinkingDroppedInputTransformation|BetaThinkingDroppedInputTransformationShape>|null $inputTransformations
544+
*/
545+
public function withInputTransformations(?array $inputTransformations): self
546+
{
547+
$self = clone $this;
548+
$self['inputTransformations'] = $inputTransformations;
549+
550+
return $self;
551+
}
492552
}

src/Beta/Messages/BetaMessageParam.php

Lines changed: 67 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,24 @@
44

55
namespace Anthropic\Beta\Messages;
66

7+
use Anthropic\Beta\Messages\BetaMessageParam\ClearAt;
78
use Anthropic\Beta\Messages\BetaMessageParam\Content;
89
use Anthropic\Beta\Messages\BetaMessageParam\Role;
10+
use Anthropic\Core\Attributes\Optional;
911
use Anthropic\Core\Attributes\Required;
1012
use Anthropic\Core\Concerns\SdkModel;
1113
use Anthropic\Core\Contracts\BaseModel;
1214

1315
/**
1416
* @phpstan-import-type ContentVariants from \Anthropic\Beta\Messages\BetaMessageParam\Content
1517
* @phpstan-import-type ContentShape from \Anthropic\Beta\Messages\BetaMessageParam\Content
18+
* @phpstan-import-type BetaSystemMessageOutputConfigShape from \Anthropic\Beta\Messages\BetaSystemMessageOutputConfig
1619
*
1720
* @phpstan-type BetaMessageParamShape = array{
18-
* content: ContentShape, role: Role|value-of<Role>
21+
* content: ContentShape,
22+
* role: Role|value-of<Role>,
23+
* clearAt?: null|ClearAt|value-of<ClearAt>,
24+
* outputConfig?: null|BetaSystemMessageOutputConfig|BetaSystemMessageOutputConfigShape,
1925
* }
2026
*/
2127
final class BetaMessageParam implements BaseModel
@@ -31,6 +37,24 @@ final class BetaMessageParam implements BaseModel
3137
#[Required(enum: Role::class)]
3238
public string $role;
3339

40+
/**
41+
* How long this system message's text stays in front of the model. `"never"` (the default) renders it on every request that includes it. `"next_user_message"` renders it only for the user turn it follows: once a later `role: "user"` message exists in `messages` the message stays in the array (send it unchanged) but is no longer shown to the model. Only permitted on `role: "system"` messages.
42+
*
43+
* @var value-of<ClearAt>|null $clearAt
44+
*/
45+
#[Optional('clear_at', enum: ClearAt::class, nullable: true)]
46+
public ?string $clearAt;
47+
48+
/**
49+
* Per-message output configuration on a role:"system" input message.
50+
*
51+
* Fields here apply per-turn; ``format`` remains top-level only. An
52+
* empty ``{}`` is accepted on a message that carries content; a message
53+
* with neither content nor output_config fields is rejected.
54+
*/
55+
#[Optional('output_config', nullable: true)]
56+
public ?BetaSystemMessageOutputConfig $outputConfig;
57+
3458
/**
3559
* `new BetaMessageParam()` is missing required properties by the API.
3660
*
@@ -57,14 +81,23 @@ public function __construct()
5781
*
5882
* @param ContentShape $content
5983
* @param Role|value-of<Role> $role
84+
* @param ClearAt|value-of<ClearAt>|null $clearAt
85+
* @param BetaSystemMessageOutputConfig|BetaSystemMessageOutputConfigShape|null $outputConfig
6086
*/
61-
public static function with(string|array $content, Role|string $role): self
62-
{
87+
public static function with(
88+
string|array $content,
89+
Role|string $role,
90+
ClearAt|string|null $clearAt = null,
91+
BetaSystemMessageOutputConfig|array|null $outputConfig = null,
92+
): self {
6393
$self = new self;
6494

6595
$self['content'] = $content;
6696
$self['role'] = $role;
6797

98+
null !== $clearAt && $self['clearAt'] = $clearAt;
99+
null !== $outputConfig && $self['outputConfig'] = $outputConfig;
100+
68101
return $self;
69102
}
70103

@@ -89,4 +122,35 @@ public function withRole(Role|string $role): self
89122

90123
return $self;
91124
}
125+
126+
/**
127+
* How long this system message's text stays in front of the model. `"never"` (the default) renders it on every request that includes it. `"next_user_message"` renders it only for the user turn it follows: once a later `role: "user"` message exists in `messages` the message stays in the array (send it unchanged) but is no longer shown to the model. Only permitted on `role: "system"` messages.
128+
*
129+
* @param ClearAt|value-of<ClearAt>|null $clearAt
130+
*/
131+
public function withClearAt(ClearAt|string|null $clearAt): self
132+
{
133+
$self = clone $this;
134+
$self['clearAt'] = $clearAt;
135+
136+
return $self;
137+
}
138+
139+
/**
140+
* Per-message output configuration on a role:"system" input message.
141+
*
142+
* Fields here apply per-turn; ``format`` remains top-level only. An
143+
* empty ``{}`` is accepted on a message that carries content; a message
144+
* with neither content nor output_config fields is rejected.
145+
*
146+
* @param BetaSystemMessageOutputConfig|BetaSystemMessageOutputConfigShape|null $outputConfig
147+
*/
148+
public function withOutputConfig(
149+
BetaSystemMessageOutputConfig|array|null $outputConfig
150+
): self {
151+
$self = clone $this;
152+
$self['outputConfig'] = $outputConfig;
153+
154+
return $self;
155+
}
92156
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Anthropic\Beta\Messages\BetaMessageParam;
6+
7+
/**
8+
* How long this system message's text stays in front of the model. `"never"` (the default) renders it on every request that includes it. `"next_user_message"` renders it only for the user turn it follows: once a later `role: "user"` message exists in `messages` the message stays in the array (send it unchanged) but is no longer shown to the model. Only permitted on `role: "system"` messages.
9+
*/
10+
enum ClearAt: string
11+
{
12+
case NEXT_USER_MESSAGE = 'next_user_message';
13+
14+
case NEVER = 'never';
15+
}

src/Beta/Messages/BetaRawMessageDeltaEvent.php

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
namespace Anthropic\Beta\Messages;
66

77
use Anthropic\Beta\Messages\BetaRawMessageDeltaEvent\Delta;
8+
use Anthropic\Core\Attributes\Optional;
89
use Anthropic\Core\Attributes\Required;
910
use Anthropic\Core\Concerns\SdkModel;
1011
use Anthropic\Core\Contracts\BaseModel;
@@ -13,12 +14,14 @@
1314
* @phpstan-import-type BetaContextManagementResponseShape from \Anthropic\Beta\Messages\BetaContextManagementResponse
1415
* @phpstan-import-type DeltaShape from \Anthropic\Beta\Messages\BetaRawMessageDeltaEvent\Delta
1516
* @phpstan-import-type BetaMessageDeltaUsageShape from \Anthropic\Beta\Messages\BetaMessageDeltaUsage
17+
* @phpstan-import-type BetaThinkingDroppedInputTransformationShape from \Anthropic\Beta\Messages\BetaThinkingDroppedInputTransformation
1618
*
1719
* @phpstan-type BetaRawMessageDeltaEventShape = array{
1820
* contextManagement: null|BetaContextManagementResponse|BetaContextManagementResponseShape,
1921
* delta: Delta|DeltaShape,
2022
* type: 'message_delta',
2123
* usage: BetaMessageDeltaUsage|BetaMessageDeltaUsageShape,
24+
* inputTransformations?: list<BetaThinkingDroppedInputTransformation|BetaThinkingDroppedInputTransformationShape>|null,
2225
* }
2326
*/
2427
final class BetaRawMessageDeltaEvent implements BaseModel
@@ -53,6 +56,32 @@ final class BetaRawMessageDeltaEvent implements BaseModel
5356
#[Required]
5457
public BetaMessageDeltaUsage $usage;
5558

59+
/**
60+
* Changes the API made to the request's input before showing it to the model:
61+
* one entry per change, in request order. Today the only entry type is
62+
* `thinking_dropped` — a `thinking`, `redacted_thinking` or `connector_text`
63+
* block from the request's `messages` that was removed from the prompt instead
64+
* of being shown to the model because it failed a binding check. More entry
65+
* types may be added over time; ignore types you do not recognize.
66+
*
67+
* Requires `anthropic-beta: thinking-binding-controls-2026-08-01`. Present on
68+
* every such response from a model that supports extended thinking, as `[]`
69+
* when nothing was changed; without the beta, blocks are removed all the same
70+
* but nothing is reported. Removed blocks contribute nothing to
71+
* `usage.input_tokens`. When streaming, the array is final in `message_start`;
72+
* the final `message_delta` event carries it only when a server-side model
73+
* fallback happened mid-stream, in which case it holds the serving model's
74+
* entries and replaces the one in `message_start`.
75+
*
76+
* @var list<BetaThinkingDroppedInputTransformation>|null $inputTransformations
77+
*/
78+
#[Optional(
79+
'input_transformations',
80+
list: BetaThinkingDroppedInputTransformation::class,
81+
nullable: true,
82+
)]
83+
public ?array $inputTransformations;
84+
5685
/**
5786
* `new BetaRawMessageDeltaEvent()` is missing required properties by the API.
5887
*
@@ -83,18 +112,22 @@ public function __construct()
83112
* @param BetaContextManagementResponse|BetaContextManagementResponseShape|null $contextManagement
84113
* @param Delta|DeltaShape $delta
85114
* @param BetaMessageDeltaUsage|BetaMessageDeltaUsageShape $usage
115+
* @param list<BetaThinkingDroppedInputTransformation|BetaThinkingDroppedInputTransformationShape>|null $inputTransformations
86116
*/
87117
public static function with(
88118
BetaContextManagementResponse|array|null $contextManagement,
89119
Delta|array $delta,
90120
BetaMessageDeltaUsage|array $usage,
121+
?array $inputTransformations = null,
91122
): self {
92123
$self = new self;
93124

94125
$self['contextManagement'] = $contextManagement;
95126
$self['delta'] = $delta;
96127
$self['usage'] = $usage;
97128

129+
null !== $inputTransformations && $self['inputTransformations'] = $inputTransformations;
130+
98131
return $self;
99132
}
100133

@@ -154,4 +187,31 @@ public function withUsage(BetaMessageDeltaUsage|array $usage): self
154187

155188
return $self;
156189
}
190+
191+
/**
192+
* Changes the API made to the request's input before showing it to the model:
193+
* one entry per change, in request order. Today the only entry type is
194+
* `thinking_dropped` — a `thinking`, `redacted_thinking` or `connector_text`
195+
* block from the request's `messages` that was removed from the prompt instead
196+
* of being shown to the model because it failed a binding check. More entry
197+
* types may be added over time; ignore types you do not recognize.
198+
*
199+
* Requires `anthropic-beta: thinking-binding-controls-2026-08-01`. Present on
200+
* every such response from a model that supports extended thinking, as `[]`
201+
* when nothing was changed; without the beta, blocks are removed all the same
202+
* but nothing is reported. Removed blocks contribute nothing to
203+
* `usage.input_tokens`. When streaming, the array is final in `message_start`;
204+
* the final `message_delta` event carries it only when a server-side model
205+
* fallback happened mid-stream, in which case it holds the serving model's
206+
* entries and replaces the one in `message_start`.
207+
*
208+
* @param list<BetaThinkingDroppedInputTransformation|BetaThinkingDroppedInputTransformationShape>|null $inputTransformations
209+
*/
210+
public function withInputTransformations(?array $inputTransformations): self
211+
{
212+
$self = clone $this;
213+
$self['inputTransformations'] = $inputTransformations;
214+
215+
return $self;
216+
}
157217
}

0 commit comments

Comments
 (0)