diff --git a/.release-please-manifest.json b/.release-please-manifest.json index ffb929a..a80c237 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.12.1" + ".": "1.12.2" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index b3a3f2f..e7f771c 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 116 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/anthropic/anthropic-5ce93251152bd7c4c288dacdf5a445383825ba50bc472ff9e9821ee9455e3564.yml -openapi_spec_hash: 989d596f7660ce55a7cea748a9292b45 -config_hash: 44acd8a997dff056931fb4466201cdeb +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/anthropic/anthropic-a548d120cebb4d68d46c828028d51d04b4d4abb868a7bad21dad960cb72cbd18.yml +openapi_spec_hash: 2b3214760a4e23a9704779ac99bce417 +config_hash: ce2cd5d2f03228adacf04ebcceb14465 diff --git a/CHANGELOG.md b/CHANGELOG.md index cb71022..c3037b4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,19 @@ # Changelog +## 1.12.2 (2026-06-24) + +Full Changelog: [v1.12.1...v1.12.2](https://github.com/anthropics/anthropic-cli/compare/v1.12.1...v1.12.2) + +### Chores + +* **api:** add support for sending User Profile ID in request headers ([2a9ec20](https://github.com/anthropics/anthropic-cli/commit/2a9ec20801996eb19686496cebfbdfb3a9420d37)) +* **internal:** codegen related update ([70616f5](https://github.com/anthropics/anthropic-cli/commit/70616f54b54e6a48daab449acb3a9e99c42508da)) + + +### Documentation + +* **model-release:** model-ID-launch checklist ([62562f3](https://github.com/anthropics/anthropic-cli/commit/62562f3cf05adb984e844d831d2db8d461157775)) + ## 1.12.1 (2026-06-10) Full Changelog: [v1.12.0...v1.12.1](https://github.com/anthropics/anthropic-cli/compare/v1.12.0...v1.12.1) diff --git a/go.mod b/go.mod index 5eec99c..95140d2 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/anthropics/anthropic-cli go 1.25 require ( - github.com/anthropics/anthropic-sdk-go v1.50.1 + github.com/anthropics/anthropic-sdk-go v1.51.1 github.com/charmbracelet/bubbles v0.21.0 github.com/charmbracelet/bubbletea v1.3.6 github.com/charmbracelet/lipgloss v1.1.0 diff --git a/go.sum b/go.sum index 17cbb68..3535cdd 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,5 @@ -github.com/anthropics/anthropic-sdk-go v1.50.1 h1:XTd1RkdeHCPusPpzcBY5RIWj/WW6ZktjftxrHvQBJfU= -github.com/anthropics/anthropic-sdk-go v1.50.1/go.mod h1:3EfIfmFqxH6rbiLcIP4tPFyXL/IHakx2wDG4OU+TIEI= +github.com/anthropics/anthropic-sdk-go v1.51.1 h1:V6VJb6lHMXw25i0bITGCj2fHHCq1WCg76s7XAQYOgSs= +github.com/anthropics/anthropic-sdk-go v1.51.1/go.mod h1:3EfIfmFqxH6rbiLcIP4tPFyXL/IHakx2wDG4OU+TIEI= github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiErDT4WkJ2k= github.com/aymanbagabas/go-osc52/v2 v2.0.1/go.mod h1:uYgXzlJ7ZpABp8OJ+exZzJJhRNQ2ASbcXHWsFqH8hp8= github.com/aymanbagabas/go-udiff v0.2.0 h1:TK0fH4MteXUDspT88n8CKzvK0X9O2xu9yQjWpi6yML8= diff --git a/pkg/cmd/betaagent.go b/pkg/cmd/betaagent.go index 4ff656d..10f1de7 100644 --- a/pkg/cmd/betaagent.go +++ b/pkg/cmd/betaagent.go @@ -38,7 +38,7 @@ var betaAgentsCreate = requestflag.WithInnerFlags(cli.Command{ }, &requestflag.Flag[[]map[string]any]{ Name: "mcp-server", - Usage: "MCP servers this agent connects to. Maximum 20. Names must be unique within the array.", + Usage: "MCP servers this agent connects to. Maximum 20. Names must be unique within the array. Every server must be referenced by an `mcp_toolset` in `tools`; unreferenced servers are rejected. See the [MCP connector guide](https://platform.claude.com/docs/en/managed-agents/mcp-connector).", BodyPath: "mcp_servers", }, &requestflag.Flag[map[string]any]{ @@ -155,7 +155,7 @@ var betaAgentsUpdate = requestflag.WithInnerFlags(cli.Command{ }, &requestflag.Flag[any]{ Name: "mcp-server", - Usage: "MCP servers. Full replacement. Omit to preserve; send empty array or null to clear. Names must be unique. Maximum 20.", + Usage: "MCP servers. Full replacement. Omit to preserve; send empty array or `null` to clear. Names must be unique. Maximum 20. Every server must be referenced by an `mcp_toolset` in the agent's resulting `tools`; unreferenced servers are rejected. See the [MCP connector guide](https://platform.claude.com/docs/en/managed-agents/mcp-connector).", BodyPath: "mcp_servers", }, &requestflag.Flag[map[string]any]{ diff --git a/pkg/cmd/betamessage.go b/pkg/cmd/betamessage.go index 7b173af..e0c59eb 100644 --- a/pkg/cmd/betamessage.go +++ b/pkg/cmd/betamessage.go @@ -142,16 +142,16 @@ var betaMessagesCreate = requestflag.WithInnerFlags(cli.Command{ Usage: "Use nucleus sampling.\n\nIn nucleus sampling, we compute the cumulative distribution over all the options for each subsequent token in decreasing probability order and cut it off once it reaches a particular probability specified by `top_p`.\n\nRecommended for advanced use cases only.", BodyPath: "top_p", }, - &requestflag.Flag[*string]{ - Name: "user-profile-id", - Usage: "The user profile ID to attribute this request to. Use when acting on behalf of a party other than your organization.", - BodyPath: "user_profile_id", - }, &requestflag.Flag[[]string]{ Name: "beta", Usage: "Optional header to specify the beta version(s) you want to use.", HeaderPath: "anthropic-beta", }, + &requestflag.Flag[string]{ + Name: "user-profile-id", + Usage: "The user profile ID to attribute this request to. Use when acting on behalf of a party other than your organization. Requires the `user-profiles` beta header.", + HeaderPath: "anthropic-user-profile-id", + }, &requestflag.Flag[int64]{ Name: "max-items", Usage: "The maximum number of items to return (use -1 for unlimited).", @@ -179,7 +179,7 @@ var betaMessagesCreate = requestflag.WithInnerFlags(cli.Command{ }, &requestflag.InnerFlag[string]{ Name: "cache-control.ttl", - Usage: "The time-to-live for the cache control breakpoint.\n\nThis may be one the following values:\n- `5m`: 5 minutes\n- `1h`: 1 hour\n\nDefaults to `5m`.", + Usage: "The time-to-live for the cache control breakpoint.\n\nThis may be one the following values:\n- `5m`: 5 minutes\n- `1h`: 1 hour\n\nDefaults to `5m`. See [prompt caching pricing](https://docs.claude.com/en/docs/build-with-claude/prompt-caching) for details.", InnerField: "ttl", }, }, @@ -377,7 +377,7 @@ var betaMessagesCountTokens = requestflag.WithInnerFlags(cli.Command{ }, &requestflag.InnerFlag[string]{ Name: "cache-control.ttl", - Usage: "The time-to-live for the cache control breakpoint.\n\nThis may be one the following values:\n- `5m`: 5 minutes\n- `1h`: 1 hour\n\nDefaults to `5m`.", + Usage: "The time-to-live for the cache control breakpoint.\n\nThis may be one the following values:\n- `5m`: 5 minutes\n- `1h`: 1 hour\n\nDefaults to `5m`. See [prompt caching pricing](https://docs.claude.com/en/docs/build-with-claude/prompt-caching) for details.", InnerField: "ttl", }, }, diff --git a/pkg/cmd/betamessage_test.go b/pkg/cmd/betamessage_test.go index 6178ffc..b53388d 100644 --- a/pkg/cmd/betamessage_test.go +++ b/pkg/cmd/betamessage_test.go @@ -41,8 +41,8 @@ func TestBetaMessagesCreate(t *testing.T) { "--tool", "{input_schema: {type: object, properties: {location: bar, unit: bar}, required: [location]}, name: name, allowed_callers: [direct], cache_control: {type: ephemeral, ttl: 5m}, defer_loading: true, description: Get the current weather in a given location, eager_input_streaming: true, input_examples: [{foo: bar}], strict: true, type: custom}", "--top-k", "5", "--top-p", "0.7", - "--user-profile-id", "user_profile_id", "--beta", "message-batches-2024-09-24", + "--user-profile-id", "anthropic-user-profile-id", ) }) @@ -94,8 +94,8 @@ func TestBetaMessagesCreate(t *testing.T) { "--tool", "{input_schema: {type: object, properties: {location: bar, unit: bar}, required: [location]}, name: name, allowed_callers: [direct], cache_control: {type: ephemeral, ttl: 5m}, defer_loading: true, description: Get the current weather in a given location, eager_input_streaming: true, input_examples: [{foo: bar}], strict: true, type: custom}", "--top-k", "5", "--top-p", "0.7", - "--user-profile-id", "user_profile_id", "--beta", "message-batches-2024-09-24", + "--user-profile-id", "anthropic-user-profile-id", ) }) @@ -237,14 +237,14 @@ func TestBetaMessagesCreate(t *testing.T) { " strict: true\n" + " type: custom\n" + "top_k: 5\n" + - "top_p: 0.7\n" + - "user_profile_id: user_profile_id\n") + "top_p: 0.7\n") mocktest.TestRunMockTestWithPipeAndFlags( t, pipeData, "--api-key", "string", "beta:messages", "create", "--max-items", "10", "--beta", "message-batches-2024-09-24", + "--user-profile-id", "anthropic-user-profile-id", ) }) } diff --git a/pkg/cmd/betamessagebatch.go b/pkg/cmd/betamessagebatch.go index 65639a0..0fc570d 100644 --- a/pkg/cmd/betamessagebatch.go +++ b/pkg/cmd/betamessagebatch.go @@ -30,6 +30,11 @@ var betaMessagesBatchesCreate = requestflag.WithInnerFlags(cli.Command{ Usage: "Optional header to specify the beta version(s) you want to use.", HeaderPath: "anthropic-beta", }, + &requestflag.Flag[string]{ + Name: "user-profile-id", + Usage: "The user profile ID to attribute the requests in this batch to. Use when acting on behalf of a party other than your organization. Requires the `user-profiles` beta header. Applies to every request in the batch; an individual request whose `user_profile_id` body field conflicts with this header is errored.", + HeaderPath: "anthropic-user-profile-id", + }, }, Action: handleBetaMessagesBatchesCreate, HideHelpCommand: true, diff --git a/pkg/cmd/betamessagebatch_test.go b/pkg/cmd/betamessagebatch_test.go index 1f16a65..8517e5e 100644 --- a/pkg/cmd/betamessagebatch_test.go +++ b/pkg/cmd/betamessagebatch_test.go @@ -15,8 +15,9 @@ func TestBetaMessagesBatchesCreate(t *testing.T) { t, "--api-key", "string", "beta:messages:batches", "create", - "--request", "{custom_id: my-custom-id-1, params: {max_tokens: 1024, messages: [{content: [{text: x, type: text, cache_control: {type: ephemeral, ttl: 5m}, citations: [{cited_text: cited_text, document_index: 0, document_title: x, end_char_index: 0, start_char_index: 0, type: char_location}]}], role: user}], model: claude-opus-4-6, cache_control: {type: ephemeral, ttl: 5m}, container: {id: id, skills: [{skill_id: pdf, type: anthropic, version: latest}]}, context_management: {edits: [{type: clear_tool_uses_20250919, clear_at_least: {type: input_tokens, value: 0}, clear_tool_inputs: true, exclude_tools: [string], keep: {type: tool_uses, value: 0}, trigger: {type: input_tokens, value: 1}}]}, diagnostics: {previous_message_id: previous_message_id}, fallback_credit_token: x, fallbacks: [{model: claude-fable-5, max_tokens: 0, output_config: {effort: low, format: {schema: {foo: bar}, type: json_schema}, task_budget: {total: 1024, type: tokens, remaining: 0}}, speed: standard, thinking: {budget_tokens: 1024, type: enabled, display: summarized}}], inference_geo: inference_geo, mcp_servers: [{name: name, type: url, url: url, authorization_token: authorization_token, tool_configuration: {allowed_tools: [string], enabled: true}}], metadata: {user_id: 13803d75-b4b5-4c3e-b2a2-6f21399b021b}, output_config: {effort: low, format: {schema: {foo: bar}, type: json_schema}, task_budget: {total: 1024, type: tokens, remaining: 0}}, output_format: {schema: {foo: bar}, type: json_schema}, service_tier: auto, speed: standard, stop_sequences: [string], stream: true, system: [{text: Today's date is 2024-06-01., type: text, cache_control: {type: ephemeral, ttl: 5m}, citations: [{cited_text: cited_text, document_index: 0, document_title: x, end_char_index: 0, start_char_index: 0, type: char_location}]}], temperature: 1, thinking: {type: adaptive, display: summarized}, tool_choice: {type: auto, disable_parallel_tool_use: true}, tools: [{input_schema: {type: object, properties: {location: bar, unit: bar}, required: [location]}, name: name, allowed_callers: [direct], cache_control: {type: ephemeral, ttl: 5m}, defer_loading: true, description: Get the current weather in a given location, eager_input_streaming: true, input_examples: [{foo: bar}], strict: true, type: custom}], top_k: 5, top_p: 0.7, user_profile_id: user_profile_id}}", + "--request", "{custom_id: my-custom-id-1, params: {max_tokens: 1024, messages: [{content: [{text: x, type: text, cache_control: {type: ephemeral, ttl: 5m}, citations: [{cited_text: cited_text, document_index: 0, document_title: x, end_char_index: 0, start_char_index: 0, type: char_location}]}], role: user}], model: claude-opus-4-6, cache_control: {type: ephemeral, ttl: 5m}, container: {id: id, skills: [{skill_id: pdf, type: anthropic, version: latest}]}, context_management: {edits: [{type: clear_tool_uses_20250919, clear_at_least: {type: input_tokens, value: 0}, clear_tool_inputs: true, exclude_tools: [string], keep: {type: tool_uses, value: 0}, trigger: {type: input_tokens, value: 1}}]}, diagnostics: {previous_message_id: previous_message_id}, fallback_credit_token: x, fallbacks: [{model: claude-fable-5, max_tokens: 0, output_config: {effort: low, format: {schema: {foo: bar}, type: json_schema}, task_budget: {total: 1024, type: tokens, remaining: 0}}, speed: standard, thinking: {budget_tokens: 1024, type: enabled, display: summarized}}], inference_geo: inference_geo, mcp_servers: [{name: name, type: url, url: url, authorization_token: authorization_token, tool_configuration: {allowed_tools: [string], enabled: true}}], metadata: {user_id: 13803d75-b4b5-4c3e-b2a2-6f21399b021b}, output_config: {effort: low, format: {schema: {foo: bar}, type: json_schema}, task_budget: {total: 1024, type: tokens, remaining: 0}}, output_format: {schema: {foo: bar}, type: json_schema}, service_tier: auto, speed: standard, stop_sequences: [string], stream: false, system: [{text: Today's date is 2024-06-01., type: text, cache_control: {type: ephemeral, ttl: 5m}, citations: [{cited_text: cited_text, document_index: 0, document_title: x, end_char_index: 0, start_char_index: 0, type: char_location}]}], temperature: 1, thinking: {type: adaptive, display: summarized}, tool_choice: {type: auto, disable_parallel_tool_use: true}, tools: [{input_schema: {type: object, properties: {location: bar, unit: bar}, required: [location]}, name: name, allowed_callers: [direct], cache_control: {type: ephemeral, ttl: 5m}, defer_loading: true, description: Get the current weather in a given location, eager_input_streaming: true, input_examples: [{foo: bar}], strict: true, type: custom}], top_k: 5, top_p: 0.7}}", "--beta", "message-batches-2024-09-24", + "--user-profile-id", "anthropic-user-profile-id", ) }) @@ -30,8 +31,9 @@ func TestBetaMessagesBatchesCreate(t *testing.T) { "--api-key", "string", "beta:messages:batches", "create", "--request.custom-id", "my-custom-id-1", - "--request.params", "{max_tokens: 1024, messages: [{content: [{text: x, type: text, cache_control: {type: ephemeral, ttl: 5m}, citations: [{cited_text: cited_text, document_index: 0, document_title: x, end_char_index: 0, start_char_index: 0, type: char_location}]}], role: user}], model: claude-opus-4-6, cache_control: {type: ephemeral, ttl: 5m}, container: {id: id, skills: [{skill_id: pdf, type: anthropic, version: latest}]}, context_management: {edits: [{type: clear_tool_uses_20250919, clear_at_least: {type: input_tokens, value: 0}, clear_tool_inputs: true, exclude_tools: [string], keep: {type: tool_uses, value: 0}, trigger: {type: input_tokens, value: 1}}]}, diagnostics: {previous_message_id: previous_message_id}, fallback_credit_token: x, fallbacks: [{model: claude-fable-5, max_tokens: 0, output_config: {effort: low, format: {schema: {foo: bar}, type: json_schema}, task_budget: {total: 1024, type: tokens, remaining: 0}}, speed: standard, thinking: {budget_tokens: 1024, type: enabled, display: summarized}}], inference_geo: inference_geo, mcp_servers: [{name: name, type: url, url: url, authorization_token: authorization_token, tool_configuration: {allowed_tools: [string], enabled: true}}], metadata: {user_id: 13803d75-b4b5-4c3e-b2a2-6f21399b021b}, output_config: {effort: low, format: {schema: {foo: bar}, type: json_schema}, task_budget: {total: 1024, type: tokens, remaining: 0}}, output_format: {schema: {foo: bar}, type: json_schema}, service_tier: auto, speed: standard, stop_sequences: [string], stream: true, system: [{text: Today's date is 2024-06-01., type: text, cache_control: {type: ephemeral, ttl: 5m}, citations: [{cited_text: cited_text, document_index: 0, document_title: x, end_char_index: 0, start_char_index: 0, type: char_location}]}], temperature: 1, thinking: {type: adaptive, display: summarized}, tool_choice: {type: auto, disable_parallel_tool_use: true}, tools: [{input_schema: {type: object, properties: {location: bar, unit: bar}, required: [location]}, name: name, allowed_callers: [direct], cache_control: {type: ephemeral, ttl: 5m}, defer_loading: true, description: Get the current weather in a given location, eager_input_streaming: true, input_examples: [{foo: bar}], strict: true, type: custom}], top_k: 5, top_p: 0.7, user_profile_id: user_profile_id}", + "--request.params", "{max_tokens: 1024, messages: [{content: [{text: x, type: text, cache_control: {type: ephemeral, ttl: 5m}, citations: [{cited_text: cited_text, document_index: 0, document_title: x, end_char_index: 0, start_char_index: 0, type: char_location}]}], role: user}], model: claude-opus-4-6, cache_control: {type: ephemeral, ttl: 5m}, container: {id: id, skills: [{skill_id: pdf, type: anthropic, version: latest}]}, context_management: {edits: [{type: clear_tool_uses_20250919, clear_at_least: {type: input_tokens, value: 0}, clear_tool_inputs: true, exclude_tools: [string], keep: {type: tool_uses, value: 0}, trigger: {type: input_tokens, value: 1}}]}, diagnostics: {previous_message_id: previous_message_id}, fallback_credit_token: x, fallbacks: [{model: claude-fable-5, max_tokens: 0, output_config: {effort: low, format: {schema: {foo: bar}, type: json_schema}, task_budget: {total: 1024, type: tokens, remaining: 0}}, speed: standard, thinking: {budget_tokens: 1024, type: enabled, display: summarized}}], inference_geo: inference_geo, mcp_servers: [{name: name, type: url, url: url, authorization_token: authorization_token, tool_configuration: {allowed_tools: [string], enabled: true}}], metadata: {user_id: 13803d75-b4b5-4c3e-b2a2-6f21399b021b}, output_config: {effort: low, format: {schema: {foo: bar}, type: json_schema}, task_budget: {total: 1024, type: tokens, remaining: 0}}, output_format: {schema: {foo: bar}, type: json_schema}, service_tier: auto, speed: standard, stop_sequences: [string], stream: false, system: [{text: Today's date is 2024-06-01., type: text, cache_control: {type: ephemeral, ttl: 5m}, citations: [{cited_text: cited_text, document_index: 0, document_title: x, end_char_index: 0, start_char_index: 0, type: char_location}]}], temperature: 1, thinking: {type: adaptive, display: summarized}, tool_choice: {type: auto, disable_parallel_tool_use: true}, tools: [{input_schema: {type: object, properties: {location: bar, unit: bar}, required: [location]}, name: name, allowed_callers: [direct], cache_control: {type: ephemeral, ttl: 5m}, defer_loading: true, description: Get the current weather in a given location, eager_input_streaming: true, input_examples: [{foo: bar}], strict: true, type: custom}], top_k: 5, top_p: 0.7}", "--beta", "message-batches-2024-09-24", + "--user-profile-id", "anthropic-user-profile-id", ) }) @@ -133,7 +135,7 @@ func TestBetaMessagesBatchesCreate(t *testing.T) { " speed: standard\n" + " stop_sequences:\n" + " - string\n" + - " stream: true\n" + + " stream: false\n" + " system:\n" + " - text: Today's date is 2024-06-01.\n" + " type: text\n" + @@ -176,13 +178,13 @@ func TestBetaMessagesBatchesCreate(t *testing.T) { " strict: true\n" + " type: custom\n" + " top_k: 5\n" + - " top_p: 0.7\n" + - " user_profile_id: user_profile_id\n") + " top_p: 0.7\n") mocktest.TestRunMockTestWithPipeAndFlags( t, pipeData, "--api-key", "string", "beta:messages:batches", "create", "--beta", "message-batches-2024-09-24", + "--user-profile-id", "anthropic-user-profile-id", ) }) } diff --git a/pkg/cmd/message.go b/pkg/cmd/message.go index aeadb41..4cf999f 100644 --- a/pkg/cmd/message.go +++ b/pkg/cmd/message.go @@ -109,6 +109,11 @@ var messagesCreate = requestflag.WithInnerFlags(cli.Command{ Usage: "Use nucleus sampling.\n\nIn nucleus sampling, we compute the cumulative distribution over all the options for each subsequent token in decreasing probability order and cut it off once it reaches a particular probability specified by `top_p`.\n\nRecommended for advanced use cases only.", BodyPath: "top_p", }, + &requestflag.Flag[string]{ + Name: "user-profile-id", + Usage: "The user profile ID to attribute this request to. Use when acting on behalf of a party other than your organization. Requires the `user-profiles` beta header.", + HeaderPath: "anthropic-user-profile-id", + }, &requestflag.Flag[int64]{ Name: "max-items", Usage: "The maximum number of items to return (use -1 for unlimited).", @@ -136,7 +141,7 @@ var messagesCreate = requestflag.WithInnerFlags(cli.Command{ }, &requestflag.InnerFlag[string]{ Name: "cache-control.ttl", - Usage: "The time-to-live for the cache control breakpoint.\n\nThis may be one the following values:\n- `5m`: 5 minutes\n- `1h`: 1 hour\n\nDefaults to `5m`.", + Usage: "The time-to-live for the cache control breakpoint.\n\nThis may be one the following values:\n- `5m`: 5 minutes\n- `1h`: 1 hour\n\nDefaults to `5m`. See [prompt caching pricing](https://docs.claude.com/en/docs/build-with-claude/prompt-caching) for details.", InnerField: "ttl", }, }, @@ -228,7 +233,7 @@ var messagesCountTokens = requestflag.WithInnerFlags(cli.Command{ }, &requestflag.InnerFlag[string]{ Name: "cache-control.ttl", - Usage: "The time-to-live for the cache control breakpoint.\n\nThis may be one the following values:\n- `5m`: 5 minutes\n- `1h`: 1 hour\n\nDefaults to `5m`.", + Usage: "The time-to-live for the cache control breakpoint.\n\nThis may be one the following values:\n- `5m`: 5 minutes\n- `1h`: 1 hour\n\nDefaults to `5m`. See [prompt caching pricing](https://docs.claude.com/en/docs/build-with-claude/prompt-caching) for details.", InnerField: "ttl", }, }, diff --git a/pkg/cmd/message_test.go b/pkg/cmd/message_test.go index 02b840d..1969a23 100644 --- a/pkg/cmd/message_test.go +++ b/pkg/cmd/message_test.go @@ -34,6 +34,7 @@ func TestMessagesCreate(t *testing.T) { "--tool", "{input_schema: {type: object, properties: {location: bar, unit: bar}, required: [location]}, name: name, allowed_callers: [direct], cache_control: {type: ephemeral, ttl: 5m}, defer_loading: true, description: Get the current weather in a given location, eager_input_streaming: true, input_examples: [{foo: bar}], strict: true, type: custom}", "--top-k", "5", "--top-p", "0.7", + "--user-profile-id", "anthropic-user-profile-id", ) }) @@ -68,6 +69,7 @@ func TestMessagesCreate(t *testing.T) { "--tool", "{input_schema: {type: object, properties: {location: bar, unit: bar}, required: [location]}, name: name, allowed_callers: [direct], cache_control: {type: ephemeral, ttl: 5m}, defer_loading: true, description: Get the current weather in a given location, eager_input_streaming: true, input_examples: [{foo: bar}], strict: true, type: custom}", "--top-k", "5", "--top-p", "0.7", + "--user-profile-id", "anthropic-user-profile-id", ) }) @@ -156,6 +158,7 @@ func TestMessagesCreate(t *testing.T) { "--api-key", "string", "messages", "create", "--max-items", "10", + "--user-profile-id", "anthropic-user-profile-id", ) }) } diff --git a/pkg/cmd/messagebatch.go b/pkg/cmd/messagebatch.go index 5b37050..03b07c4 100644 --- a/pkg/cmd/messagebatch.go +++ b/pkg/cmd/messagebatch.go @@ -25,6 +25,11 @@ var messagesBatchesCreate = requestflag.WithInnerFlags(cli.Command{ Required: true, BodyPath: "requests", }, + &requestflag.Flag[string]{ + Name: "user-profile-id", + Usage: "The user profile ID to attribute the requests in this batch to. Use when acting on behalf of a party other than your organization. Requires the `user-profiles` beta header. Applies to every request in the batch; an individual request whose `user_profile_id` body field conflicts with this header is errored.", + HeaderPath: "anthropic-user-profile-id", + }, }, Action: handleMessagesBatchesCreate, HideHelpCommand: true, diff --git a/pkg/cmd/messagebatch_test.go b/pkg/cmd/messagebatch_test.go index 5d20686..05d017a 100644 --- a/pkg/cmd/messagebatch_test.go +++ b/pkg/cmd/messagebatch_test.go @@ -15,7 +15,8 @@ func TestMessagesBatchesCreate(t *testing.T) { t, "--api-key", "string", "messages:batches", "create", - "--request", "{custom_id: my-custom-id-1, params: {max_tokens: 1024, messages: [{content: [{text: x, type: text, cache_control: {type: ephemeral, ttl: 5m}, citations: [{cited_text: cited_text, document_index: 0, document_title: x, end_char_index: 0, start_char_index: 0, type: char_location}]}], role: user}], model: claude-opus-4-6, cache_control: {type: ephemeral, ttl: 5m}, container: container, inference_geo: inference_geo, metadata: {user_id: 13803d75-b4b5-4c3e-b2a2-6f21399b021b}, output_config: {effort: low, format: {schema: {foo: bar}, type: json_schema}}, service_tier: auto, stop_sequences: [string], stream: true, system: [{text: Today's date is 2024-06-01., type: text, cache_control: {type: ephemeral, ttl: 5m}, citations: [{cited_text: cited_text, document_index: 0, document_title: x, end_char_index: 0, start_char_index: 0, type: char_location}]}], temperature: 1, thinking: {type: adaptive, display: summarized}, tool_choice: {type: auto, disable_parallel_tool_use: true}, tools: [{input_schema: {type: object, properties: {location: bar, unit: bar}, required: [location]}, name: name, allowed_callers: [direct], cache_control: {type: ephemeral, ttl: 5m}, defer_loading: true, description: Get the current weather in a given location, eager_input_streaming: true, input_examples: [{foo: bar}], strict: true, type: custom}], top_k: 5, top_p: 0.7}}", + "--request", "{custom_id: my-custom-id-1, params: {max_tokens: 1024, messages: [{content: [{text: x, type: text, cache_control: {type: ephemeral, ttl: 5m}, citations: [{cited_text: cited_text, document_index: 0, document_title: x, end_char_index: 0, start_char_index: 0, type: char_location}]}], role: user}], model: claude-opus-4-6, cache_control: {type: ephemeral, ttl: 5m}, container: container, inference_geo: inference_geo, metadata: {user_id: 13803d75-b4b5-4c3e-b2a2-6f21399b021b}, output_config: {effort: low, format: {schema: {foo: bar}, type: json_schema}}, service_tier: auto, stop_sequences: [string], stream: false, system: [{text: Today's date is 2024-06-01., type: text, cache_control: {type: ephemeral, ttl: 5m}, citations: [{cited_text: cited_text, document_index: 0, document_title: x, end_char_index: 0, start_char_index: 0, type: char_location}]}], temperature: 1, thinking: {type: adaptive, display: summarized}, tool_choice: {type: auto, disable_parallel_tool_use: true}, tools: [{input_schema: {type: object, properties: {location: bar, unit: bar}, required: [location]}, name: name, allowed_callers: [direct], cache_control: {type: ephemeral, ttl: 5m}, defer_loading: true, description: Get the current weather in a given location, eager_input_streaming: true, input_examples: [{foo: bar}], strict: true, type: custom}], top_k: 5, top_p: 0.7}}", + "--user-profile-id", "anthropic-user-profile-id", ) }) @@ -29,7 +30,8 @@ func TestMessagesBatchesCreate(t *testing.T) { "--api-key", "string", "messages:batches", "create", "--request.custom-id", "my-custom-id-1", - "--request.params", "{max_tokens: 1024, messages: [{content: [{text: x, type: text, cache_control: {type: ephemeral, ttl: 5m}, citations: [{cited_text: cited_text, document_index: 0, document_title: x, end_char_index: 0, start_char_index: 0, type: char_location}]}], role: user}], model: claude-opus-4-6, cache_control: {type: ephemeral, ttl: 5m}, container: container, inference_geo: inference_geo, metadata: {user_id: 13803d75-b4b5-4c3e-b2a2-6f21399b021b}, output_config: {effort: low, format: {schema: {foo: bar}, type: json_schema}}, service_tier: auto, stop_sequences: [string], stream: true, system: [{text: Today's date is 2024-06-01., type: text, cache_control: {type: ephemeral, ttl: 5m}, citations: [{cited_text: cited_text, document_index: 0, document_title: x, end_char_index: 0, start_char_index: 0, type: char_location}]}], temperature: 1, thinking: {type: adaptive, display: summarized}, tool_choice: {type: auto, disable_parallel_tool_use: true}, tools: [{input_schema: {type: object, properties: {location: bar, unit: bar}, required: [location]}, name: name, allowed_callers: [direct], cache_control: {type: ephemeral, ttl: 5m}, defer_loading: true, description: Get the current weather in a given location, eager_input_streaming: true, input_examples: [{foo: bar}], strict: true, type: custom}], top_k: 5, top_p: 0.7}", + "--request.params", "{max_tokens: 1024, messages: [{content: [{text: x, type: text, cache_control: {type: ephemeral, ttl: 5m}, citations: [{cited_text: cited_text, document_index: 0, document_title: x, end_char_index: 0, start_char_index: 0, type: char_location}]}], role: user}], model: claude-opus-4-6, cache_control: {type: ephemeral, ttl: 5m}, container: container, inference_geo: inference_geo, metadata: {user_id: 13803d75-b4b5-4c3e-b2a2-6f21399b021b}, output_config: {effort: low, format: {schema: {foo: bar}, type: json_schema}}, service_tier: auto, stop_sequences: [string], stream: false, system: [{text: Today's date is 2024-06-01., type: text, cache_control: {type: ephemeral, ttl: 5m}, citations: [{cited_text: cited_text, document_index: 0, document_title: x, end_char_index: 0, start_char_index: 0, type: char_location}]}], temperature: 1, thinking: {type: adaptive, display: summarized}, tool_choice: {type: auto, disable_parallel_tool_use: true}, tools: [{input_schema: {type: object, properties: {location: bar, unit: bar}, required: [location]}, name: name, allowed_callers: [direct], cache_control: {type: ephemeral, ttl: 5m}, defer_loading: true, description: Get the current weather in a given location, eager_input_streaming: true, input_examples: [{foo: bar}], strict: true, type: custom}], top_k: 5, top_p: 0.7}", + "--user-profile-id", "anthropic-user-profile-id", ) }) @@ -72,7 +74,7 @@ func TestMessagesBatchesCreate(t *testing.T) { " service_tier: auto\n" + " stop_sequences:\n" + " - string\n" + - " stream: true\n" + + " stream: false\n" + " system:\n" + " - text: Today's date is 2024-06-01.\n" + " type: text\n" + @@ -120,6 +122,7 @@ func TestMessagesBatchesCreate(t *testing.T) { t, pipeData, "--api-key", "string", "messages:batches", "create", + "--user-profile-id", "anthropic-user-profile-id", ) }) } diff --git a/pkg/cmd/version.go b/pkg/cmd/version.go index e6fedbd..e8d823c 100644 --- a/pkg/cmd/version.go +++ b/pkg/cmd/version.go @@ -2,4 +2,4 @@ package cmd -const Version = "1.12.1" // x-release-please-version +const Version = "1.12.2" // x-release-please-version