Skip to content

Commit 0967d63

Browse files
authored
Merge branch 'anthropics:main' into md2video-audio-skill
2 parents af0bd4d + 34040c9 commit 0967d63

70 files changed

Lines changed: 2900 additions & 1817 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎skills/claude-api/SKILL.md‎

Lines changed: 193 additions & 177 deletions
Large diffs are not rendered by default.

‎skills/claude-api/csharp/claude-api/README.md‎

Lines changed: 34 additions & 34 deletions
Large diffs are not rendered by default.

‎skills/claude-api/csharp/claude-api/batches.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Message Batches — C#
1+
# Message Batches - C#
22

33
## Message Batches API
44

‎skills/claude-api/csharp/claude-api/files-api.md‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
# Files API — C#
1+
# Files API - C#
22

3-
## Files API (Beta)
3+
## Files API
4+
5+
> **Out of beta.** In current SDKs `client.Beta.Files` has breaking shape changes from previous versions, matching the stable `client.Files` - migrate per the Files API row in `shared/live-sources.md`. Examples below predate this.
46
57
Files live under `client.Beta.Files` (namespace `Anthropic.Models.Beta.Files`). `BinaryContent` implicit-converts from `Stream` and `byte[]`.
68

@@ -17,7 +19,7 @@ new BetaRequestDocumentBlock {
1719
}
1820
```
1921

20-
The non-beta `DocumentBlockParamSource` union has no file-ID variant — file references need `client.Beta.Messages.Create()`.
22+
The non-beta `DocumentBlockParamSource` union has no file-ID variant - file references need `client.Beta.Messages.Create()`.
2123

2224
---
2325

‎skills/claude-api/csharp/claude-api/streaming.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Streaming — C#
1+
# Streaming - C#
22

33
## Streaming
44

@@ -22,7 +22,7 @@ await foreach (RawMessageStreamEvent streamEvent in client.Messages.CreateStream
2222
}
2323
```
2424

25-
**`RawMessageStreamEvent` TryPick methods** (naming drops the `Message`/`Raw` prefix): `TryPickStart`, `TryPickDelta`, `TryPickStop`, `TryPickContentBlockStart`, `TryPickContentBlockDelta`, `TryPickContentBlockStop`. There is no `TryPickMessageStop` — use `TryPickStop`.
25+
**`RawMessageStreamEvent` TryPick methods** (naming drops the `Message`/`Raw` prefix): `TryPickStart`, `TryPickDelta`, `TryPickStop`, `TryPickContentBlockStart`, `TryPickContentBlockDelta`, `TryPickContentBlockStop`. There is no `TryPickMessageStop` - use `TryPickStop`.
2626

2727
---
2828

‎skills/claude-api/csharp/claude-api/tool-use.md‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
# Tool Use — C#
1+
# Tool Use - C#
22

33
For conceptual overview (tool definitions, tool choice, tips), see [shared/tool-use-concepts.md](../../shared/tool-use-concepts.md).
44

55
## Tool Use
66

77
### Defining a tool
88

9-
`Tool` (NOT `ToolParam`) with an `InputSchema` record. `InputSchema.Type` is auto-set to `"object"` by the constructor — don't set it. `ToolUnion` has an implicit conversion from `Tool`, triggered by the collection expression `[...]`.
9+
`Tool` (NOT `ToolParam`) with an `InputSchema` record. `InputSchema.Type` is auto-set to `"object"` by the constructor - don't set it. `ToolUnion` has an implicit conversion from `Tool`, triggered by the collection expression `[...]`.
1010

1111
```csharp
1212
using System.Text.Json;
@@ -38,14 +38,14 @@ Derived from `anthropic-sdk-csharp/src/Anthropic/Models/Messages/Tool.cs` and `T
3838
See [shared tool use concepts](../../shared/tool-use-concepts.md) for the loop pattern.
3939
### Converting response content to the follow-up assistant message
4040

41-
When echoing Claude's response back in the assistant turn, **there is no `.ToParam()` helper** — manually reconstruct each `ContentBlock` variant as its `*Param` counterpart. Do NOT use `new ContentBlockParam(block.Json)`: it compiles and serializes, but `.Value` stays `null` so `TryPick*`/`Validate()` fail (degraded JSON pass-through, not the typed path).
41+
When echoing Claude's response back in the assistant turn, **there is no `.ToParam()` helper** - manually reconstruct each `ContentBlock` variant as its `*Param` counterpart. Do NOT use `new ContentBlockParam(block.Json)`: it compiles and serializes, but `.Value` stays `null` so `TryPick*`/`Validate()` fail (degraded JSON pass-through, not the typed path).
4242

4343
```csharp
4444
using Anthropic.Models.Messages;
4545

4646
Message response = await client.Messages.Create(parameters);
4747

48-
// No .ToParam() — reconstruct per variant. Implicit conversions from each
48+
// No .ToParam() - reconstruct per variant. Implicit conversions from each
4949
// *Param type to ContentBlockParam mean no explicit wrapper.
5050
List<ContentBlockParam> assistantContent = [];
5151
List<ContentBlockParam> toolResults = [];
@@ -57,7 +57,7 @@ foreach (ContentBlock block in response.Content)
5757
}
5858
else if (block.TryPickThinking(out ThinkingBlock? thinking))
5959
{
60-
// Signature MUST be preserved — the API rejects tampering
60+
// Signature MUST be preserved - the API rejects tampering
6161
assistantContent.Add(new ThinkingBlockParam
6262
{
6363
Thinking = thinking.Thinking,
@@ -70,14 +70,14 @@ foreach (ContentBlock block in response.Content)
7070
}
7171
else if (block.TryPickToolUse(out ToolUseBlock? toolUse))
7272
{
73-
// ToolUseBlock has required Caller; ToolUseBlockParam.Caller is optional — don't copy it
73+
// ToolUseBlock has required Caller; ToolUseBlockParam.Caller is optional - don't copy it
7474
assistantContent.Add(new ToolUseBlockParam
7575
{
7676
ID = toolUse.ID,
7777
Name = toolUse.Name,
7878
Input = toolUse.Input,
7979
});
80-
// Execute the tool; collect ONE result per tool_use block — the API
80+
// Execute the tool; collect ONE result per tool_use block - the API
8181
// rejects the follow-up if any tool_use ID lacks a matching tool_result.
8282
string result = ExecuteYourTool(toolUse.Name, toolUse.Input);
8383
toolResults.Add(new ToolResultBlockParam
@@ -97,7 +97,7 @@ List<MessageParam> followUpMessages =
9797
];
9898
```
9999

100-
`ToolResultBlockParam` has no tuple constructor — use the object initializer. `Content` is a string-or-list union; a plain `string` implicitly converts.
100+
`ToolResultBlockParam` has no tuple constructor - use the object initializer. `Content` is a string-or-list union; a plain `string` implicitly converts.
101101

102102
---
103103

@@ -122,7 +122,7 @@ OutputConfig = new OutputConfig {
122122

123123
## Anthropic-Defined Tools
124124

125-
Web search, bash, text editor, and code execution are Anthropic-defined tools with built-in schemas. Web search and code execution are server-executed; bash and text editor are client-executed (you handle the `tool_use` locally — see `shared/tool-use-concepts.md`). Type names are version-suffixed; constructors auto-set `name`/`type`. **Wrap each in `new ToolUnion(...)` explicitly.**
125+
Web search, bash, text editor, and code execution are Anthropic-defined tools with built-in schemas. Web search and code execution are server-executed; bash and text editor are client-executed (you handle the `tool_use` locally - see `shared/tool-use-concepts.md`). Type names are version-suffixed; constructors auto-set `name`/`type`. **Wrap each in `new ToolUnion(...)` explicitly.**
126126

127127
```csharp
128128
Tools = [
@@ -139,7 +139,7 @@ Also available: `new ToolUnion(new WebFetchTool20260209())`, `new ToolUnion(new
139139

140140
## Tool Runner (Beta)
141141

142-
The C# SDK provides a `BetaToolRunner` for automatic tool execution loops. Define tools with raw JSON schemas, and the runner handles the API call → tool execution → result feedback loop.
142+
The C# SDK provides a `BetaToolRunner` for automatic tool execution loops. Define tools with raw JSON schemas, and the runner handles the API call -> tool execution -> result feedback loop.
143143

144144
```csharp
145145
using Anthropic.Models.Beta.Messages;

‎skills/claude-api/curl/examples.md‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Claude API — cURL / Raw HTTP
1+
# Claude API - cURL / Raw HTTP
22

33
Use these examples when the user needs raw HTTP requests or is working in a language without an official SDK.
44

@@ -28,7 +28,7 @@ curl https://api.anthropic.com/v1/messages \
2828

2929
### Parsing the response
3030

31-
Use `jq` to extract fields from the JSON response. Do not use `grep`/`sed` —
31+
Use `jq` to extract fields from the JSON response. Do not use `grep`/`sed` -
3232
JSON strings can contain any character and regex parsing will break on quotes,
3333
escapes, or multi-line content.
3434

@@ -183,7 +183,7 @@ For 1-hour TTL: `"cache_control": {"type": "ephemeral", "ttl": "1h"}`. Top-level
183183
## Extended Thinking
184184

185185
> **Fable 5, Claude Opus 5, Opus 4.8, Opus 4.7, Opus 4.6, and Sonnet 4.6:** Use adaptive thinking. `budget_tokens` is removed on Fable 5, Claude Opus 5, Opus 4.8, and 4.7 (400 if sent); deprecated on Opus 4.6 and Sonnet 4.6.
186-
> **Claude Opus 5:** thinking is on by default — omitting `"thinking"` runs adaptive (`{"type": "adaptive"}` is equivalent), unlike Opus 4.8/4.7 where omitting it meant no thinking. `{"type": "disabled"}` is accepted only at effort `high` or lower; pairing it with `xhigh`/`max` returns a 400.
186+
> **Claude Opus 5:** thinking is on by default - omitting `"thinking"` runs adaptive (`{"type": "adaptive"}` is equivalent), unlike Opus 4.8/4.7 where omitting it meant no thinking. `{"type": "disabled"}` is accepted only at effort `high` or lower; pairing it with `xhigh`/`max` returns a 400.
187187
> **Older models:** Use `"type": "enabled"` with `"budget_tokens": N` (must be < `max_tokens`, min 1024).
188188
189189
```bash
@@ -208,9 +208,9 @@ curl https://api.anthropic.com/v1/messages \
208208

209209
---
210210

211-
## Refusal Fallbacks (Claude Fable 5) — opt in by default
211+
## Refusal Fallbacks (Claude Fable 5.1) - opt in by default
212212

213-
On `claude-fable-5`, safety classifiers may decline a request (HTTP 200 with `stop_reason: "refusal"`). Fallbacks are **opt-in**: without them the request simply stops. Include the `fallbacks` parameter and its beta header by default — on a policy decline the API re-runs the same request on the fallback model inside the same call. A decline before any output isn't billed (a mid-stream decline bills the streamed partial); the rescue bills at the fallback model's own rates.
213+
On `claude-fable-5-1`, safety classifiers may decline a request (HTTP 200 with `stop_reason: "refusal"`). Fallbacks are **opt-in**: without them the request simply stops. Include the `fallbacks` parameter and its beta header by default - on a policy decline the API re-runs the same request on the fallback model inside the same call. A decline before any output isn't billed (a mid-stream decline bills the streamed partial); the rescue bills at the fallback model's own rates.
214214

215215
```bash
216216
response=$(curl -s https://api.anthropic.com/v1/messages \
@@ -219,7 +219,7 @@ response=$(curl -s https://api.anthropic.com/v1/messages \
219219
-H "anthropic-version: 2023-06-01" \
220220
-H "anthropic-beta: server-side-fallback-2026-06-01" \
221221
-d '{
222-
"model": "claude-fable-5",
222+
"model": "claude-fable-5-1",
223223
"max_tokens": 16000,
224224
"fallbacks": [{"model": "claude-opus-4-8"}],
225225
"messages": [{"role": "user", "content": "Hello"}]
@@ -234,15 +234,15 @@ echo "$response" | jq -r '.stop_reason'
234234
# Switch points: one fallback block per model that ran and declined this turn
235235
echo "$response" | jq -r '.content[] | select(.type == "fallback") | "\(.from.model) declined; \(.to.model) continued"'
236236

237-
# Served-by signal — covers sticky turns, which carry no fallback block.
237+
# Served-by signal - covers sticky turns, which carry no fallback block.
238238
# Pair with stop_reason: the fallback model can itself refuse.
239239
if [ "$(echo "$response" | jq -r '.stop_reason')" != "refusal" ] && \
240240
echo "$response" | jq -e '[.usage.iterations[]? | select(.type == "fallback_message")] | length > 0' > /dev/null; then
241241
echo "fallback model served this turn"
242242
fi
243243
```
244244

245-
The header must be exactly `server-side-fallback-2026-06-01` **for this array form**; the newer `fallbacks: "default"` scalar form uses `server-side-fallback-2026-07-01` instead (see `shared/model-migration.md` → Migrating to Claude Opus 5 → New API features), and pairing either header with the other form returns a 400. The parameter is rejected on the Batches API and unavailable on Amazon Bedrock, Vertex AI, and Microsoft Foundry. Full semantics (sticky routing, billing, streaming, echoing fallback turns back): `shared/model-migration.md` → Migrating to Claude Fable 5 → `refusal` stop reason.
245+
The header must be exactly `server-side-fallback-2026-06-01` **for this array form**; the newer `fallbacks: "default"` scalar form uses `server-side-fallback-2026-07-01` instead (see `shared/model-migration.md` -> Migrating to Claude Opus 5 -> New API features), and pairing either header with the other form returns a 400. The parameter is rejected on the Batches API and unavailable on Amazon Bedrock, Vertex AI, and Microsoft Foundry. Full semantics (sticky routing, billing, streaming, echoing fallback turns back): `shared/model-migration.md` -> Migrating to Claude Fable 5.1 -> `refusal` stop reason.
246246

247247
---
248248

‎skills/claude-api/curl/managed-agents.md‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Managed Agents — cURL / Raw HTTP
1+
# Managed Agents - cURL / Raw HTTP
22

33
Use these examples when the user needs raw HTTP requests or is working without an SDK.
44

@@ -55,7 +55,7 @@ curl -X POST https://api.anthropic.com/v1/environments \
5555

5656
## Create an Agent (required first step)
5757

58-
> ⚠️ **There is no inline agent config.** Under `managed-agents-2026-04-01`, `model`/`system`/`tools` are top-level fields on `POST /v1/agents`, not on the session. Always create the agent first — the session only takes `"agent": {"type": "agent", "id": "..."}`.
58+
> Warning: **There is no inline agent config.** Under `managed-agents-2026-04-01`, `model`/`system`/`tools` are top-level fields on `POST /v1/agents`, not on the session. Always create the agent first - the session only takes `"agent": {"type": "agent", "id": "..."}`.
5959
6060
### Minimal
6161

@@ -68,7 +68,7 @@ curl -X POST https://api.anthropic.com/v1/agents \
6868
"model": "claude-opus-5",
6969
"tools": [{ "type": "agent_toolset_20260401" }]
7070
}'
71-
# → { "id": "agent_abc123", ... }
71+
# -> { "id": "agent_abc123", ... }
7272

7373
# 2. Start a session
7474
curl -X POST https://api.anthropic.com/v1/sessions \
@@ -77,7 +77,7 @@ curl -X POST https://api.anthropic.com/v1/sessions \
7777
"agent": { "type": "agent", "id": "agent_abc123", "version": 1 },
7878
"environment_id": "env_abc123"
7979
}'
80-
# → { "id": "sesn_abc123", ... }
80+
# -> { "id": "sesn_abc123", ... }
8181
# Trace: https://platform.claude.com/workspaces/default/sessions/sesn_abc123 (swap 'default' for your workspace ID if the API key is not in the Default workspace)
8282
```
8383

@@ -143,13 +143,13 @@ curl -X POST https://api.anthropic.com/v1/sessions \
143143
}
144144
}'
145145

146-
# Change the cap — higher or lower, but it must exceed the consumed list cost.
146+
# Change the cap - higher or lower, but it must exceed the consumed list cost.
147147
# An accepted update resumes work paused at budget_reached
148148
curl -X POST https://api.anthropic.com/v1/sessions/$SESSION_ID \
149149
"${HEADERS[@]}" \
150150
-d '{ "budget": { "type": "limit", "max_list_cost": { "amount": "4000", "currency": "USD" } } }'
151151

152-
# Remove the cap entirely — one-way; a removed budget can never be re-added
152+
# Remove the cap entirely - one-way; a removed budget can never be re-added
153153
curl -X POST https://api.anthropic.com/v1/sessions/$SESSION_ID \
154154
"${HEADERS[@]}" \
155155
-d '{ "budget": null }'
@@ -205,7 +205,7 @@ data: {"type":"session.status_idle","id":"sevt_...","processed_at":"..."}
205205
curl https://api.anthropic.com/v1/sessions/$SESSION_ID/events \
206206
"${HEADERS[@]}"
207207

208-
# Paginated — get next page of events
208+
# Paginated - get next page of events
209209
curl "https://api.anthropic.com/v1/sessions/$SESSION_ID/events?page=page_abc123" \
210210
"${HEADERS[@]}"
211211
```
@@ -321,7 +321,7 @@ curl https://api.anthropic.com/v1/agents \
321321
## MCP Server Integration
322322

323323
```bash
324-
# 1. Agent declares MCP server (no auth here — auth goes in a vault)
324+
# 1. Agent declares MCP server (no auth here - auth goes in a vault)
325325
curl -X POST https://api.anthropic.com/v1/agents \
326326
"${HEADERS[@]}" \
327327
-d '{

0 commit comments

Comments
 (0)