diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 0c6b0698..661ffa45 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.25.0" + ".": "1.25.1" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 738d8d11..d6765477 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 1.25.1 (2026-02-19) + +Full Changelog: [v1.25.0...v1.25.1](https://github.com/anthropics/anthropic-sdk-go/compare/v1.25.0...v1.25.1) + +### Bug Fixes + +* **client:** use correct format specifier for header serialization ([9115a61](https://github.com/anthropics/anthropic-sdk-go/commit/9115a6154d0b1ba94370911822986b2ef8584e9a)) + ## 1.25.0 (2026-02-18) Full Changelog: [v1.24.0...v1.25.0](https://github.com/anthropics/anthropic-sdk-go/compare/v1.24.0...v1.25.0) diff --git a/README.md b/README.md index 3501609c..437fff68 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ Or to pin the version: ```sh -go get -u 'github.com/anthropics/anthropic-sdk-go@v1.25.0' +go get -u 'github.com/anthropics/anthropic-sdk-go@v1.25.1' ``` diff --git a/betafile.go b/betafile.go index 2f1d6477..8d09ee06 100644 --- a/betafile.go +++ b/betafile.go @@ -48,7 +48,7 @@ func NewBetaFileService(opts ...option.RequestOption) (r BetaFileService) { func (r *BetaFileService) List(ctx context.Context, params BetaFileListParams, opts ...option.RequestOption) (res *pagination.Page[FileMetadata], err error) { var raw *http.Response for _, v := range params.Betas { - opts = append(opts, option.WithHeaderAdd("anthropic-beta", fmt.Sprintf("%s", v))) + opts = append(opts, option.WithHeaderAdd("anthropic-beta", fmt.Sprintf("%v", v))) } opts = slices.Concat(r.Options, opts) opts = append([]option.RequestOption{option.WithHeader("anthropic-beta", "files-api-2025-04-14"), option.WithResponseInto(&raw)}, opts...) @@ -73,7 +73,7 @@ func (r *BetaFileService) ListAutoPaging(ctx context.Context, params BetaFileLis // Delete File func (r *BetaFileService) Delete(ctx context.Context, fileID string, body BetaFileDeleteParams, opts ...option.RequestOption) (res *DeletedFile, err error) { for _, v := range body.Betas { - opts = append(opts, option.WithHeaderAdd("anthropic-beta", fmt.Sprintf("%s", v))) + opts = append(opts, option.WithHeaderAdd("anthropic-beta", fmt.Sprintf("%v", v))) } opts = slices.Concat(r.Options, opts) opts = append([]option.RequestOption{option.WithHeader("anthropic-beta", "files-api-2025-04-14")}, opts...) @@ -89,7 +89,7 @@ func (r *BetaFileService) Delete(ctx context.Context, fileID string, body BetaFi // Download File func (r *BetaFileService) Download(ctx context.Context, fileID string, query BetaFileDownloadParams, opts ...option.RequestOption) (res *http.Response, err error) { for _, v := range query.Betas { - opts = append(opts, option.WithHeaderAdd("anthropic-beta", fmt.Sprintf("%s", v))) + opts = append(opts, option.WithHeaderAdd("anthropic-beta", fmt.Sprintf("%v", v))) } opts = slices.Concat(r.Options, opts) opts = append([]option.RequestOption{option.WithHeader("anthropic-beta", "files-api-2025-04-14"), option.WithHeader("Accept", "application/binary")}, opts...) @@ -105,7 +105,7 @@ func (r *BetaFileService) Download(ctx context.Context, fileID string, query Bet // Get File Metadata func (r *BetaFileService) GetMetadata(ctx context.Context, fileID string, query BetaFileGetMetadataParams, opts ...option.RequestOption) (res *FileMetadata, err error) { for _, v := range query.Betas { - opts = append(opts, option.WithHeaderAdd("anthropic-beta", fmt.Sprintf("%s", v))) + opts = append(opts, option.WithHeaderAdd("anthropic-beta", fmt.Sprintf("%v", v))) } opts = slices.Concat(r.Options, opts) opts = append([]option.RequestOption{option.WithHeader("anthropic-beta", "files-api-2025-04-14")}, opts...) @@ -121,7 +121,7 @@ func (r *BetaFileService) GetMetadata(ctx context.Context, fileID string, query // Upload File func (r *BetaFileService) Upload(ctx context.Context, params BetaFileUploadParams, opts ...option.RequestOption) (res *FileMetadata, err error) { for _, v := range params.Betas { - opts = append(opts, option.WithHeaderAdd("anthropic-beta", fmt.Sprintf("%s", v))) + opts = append(opts, option.WithHeaderAdd("anthropic-beta", fmt.Sprintf("%v", v))) } opts = slices.Concat(r.Options, opts) opts = append([]option.RequestOption{option.WithHeader("anthropic-beta", "files-api-2025-04-14")}, opts...) diff --git a/betamessage.go b/betamessage.go index ae4cc083..0f9b9167 100644 --- a/betamessage.go +++ b/betamessage.go @@ -53,7 +53,7 @@ func NewBetaMessageService(opts ...option.RequestOption) (r BetaMessageService) // Note: If you choose to set a timeout for this request, we recommend 10 minutes. func (r *BetaMessageService) New(ctx context.Context, params BetaMessageNewParams, opts ...option.RequestOption) (res *BetaMessage, err error) { for _, v := range params.Betas { - opts = append(opts, option.WithHeaderAdd("anthropic-beta", fmt.Sprintf("%s", v))) + opts = append(opts, option.WithHeaderAdd("anthropic-beta", fmt.Sprintf("%v", v))) } opts = slices.Concat(r.Options, opts) @@ -86,7 +86,7 @@ func (r *BetaMessageService) NewStreaming(ctx context.Context, params BetaMessag err error ) for _, v := range params.Betas { - opts = append(opts, option.WithHeaderAdd("anthropic-beta", fmt.Sprintf("%s", v))) + opts = append(opts, option.WithHeaderAdd("anthropic-beta", fmt.Sprintf("%v", v))) } opts = slices.Concat(r.Options, opts) opts = append(opts, option.WithJSONSet("stream", true)) @@ -104,7 +104,7 @@ func (r *BetaMessageService) NewStreaming(ctx context.Context, params BetaMessag // [user guide](https://docs.claude.com/en/docs/build-with-claude/token-counting) func (r *BetaMessageService) CountTokens(ctx context.Context, params BetaMessageCountTokensParams, opts ...option.RequestOption) (res *BetaMessageTokensCount, err error) { for _, v := range params.Betas { - opts = append(opts, option.WithHeaderAdd("anthropic-beta", fmt.Sprintf("%s", v))) + opts = append(opts, option.WithHeaderAdd("anthropic-beta", fmt.Sprintf("%v", v))) } opts = slices.Concat(r.Options, opts) path := "v1/messages/count_tokens?beta=true" diff --git a/betamessagebatch.go b/betamessagebatch.go index aebf46a4..dfb77f0f 100644 --- a/betamessagebatch.go +++ b/betamessagebatch.go @@ -52,7 +52,7 @@ func NewBetaMessageBatchService(opts ...option.RequestOption) (r BetaMessageBatc // [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing) func (r *BetaMessageBatchService) New(ctx context.Context, params BetaMessageBatchNewParams, opts ...option.RequestOption) (res *BetaMessageBatch, err error) { for _, v := range params.Betas { - opts = append(opts, option.WithHeaderAdd("anthropic-beta", fmt.Sprintf("%s", v))) + opts = append(opts, option.WithHeaderAdd("anthropic-beta", fmt.Sprintf("%v", v))) } opts = slices.Concat(r.Options, opts) opts = append([]option.RequestOption{option.WithHeader("anthropic-beta", "message-batches-2024-09-24")}, opts...) @@ -69,7 +69,7 @@ func (r *BetaMessageBatchService) New(ctx context.Context, params BetaMessageBat // [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing) func (r *BetaMessageBatchService) Get(ctx context.Context, messageBatchID string, query BetaMessageBatchGetParams, opts ...option.RequestOption) (res *BetaMessageBatch, err error) { for _, v := range query.Betas { - opts = append(opts, option.WithHeaderAdd("anthropic-beta", fmt.Sprintf("%s", v))) + opts = append(opts, option.WithHeaderAdd("anthropic-beta", fmt.Sprintf("%v", v))) } opts = slices.Concat(r.Options, opts) opts = append([]option.RequestOption{option.WithHeader("anthropic-beta", "message-batches-2024-09-24")}, opts...) @@ -90,7 +90,7 @@ func (r *BetaMessageBatchService) Get(ctx context.Context, messageBatchID string func (r *BetaMessageBatchService) List(ctx context.Context, params BetaMessageBatchListParams, opts ...option.RequestOption) (res *pagination.Page[BetaMessageBatch], err error) { var raw *http.Response for _, v := range params.Betas { - opts = append(opts, option.WithHeaderAdd("anthropic-beta", fmt.Sprintf("%s", v))) + opts = append(opts, option.WithHeaderAdd("anthropic-beta", fmt.Sprintf("%v", v))) } opts = slices.Concat(r.Options, opts) opts = append([]option.RequestOption{option.WithHeader("anthropic-beta", "message-batches-2024-09-24"), option.WithResponseInto(&raw)}, opts...) @@ -125,7 +125,7 @@ func (r *BetaMessageBatchService) ListAutoPaging(ctx context.Context, params Bet // [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing) func (r *BetaMessageBatchService) Delete(ctx context.Context, messageBatchID string, body BetaMessageBatchDeleteParams, opts ...option.RequestOption) (res *BetaDeletedMessageBatch, err error) { for _, v := range body.Betas { - opts = append(opts, option.WithHeaderAdd("anthropic-beta", fmt.Sprintf("%s", v))) + opts = append(opts, option.WithHeaderAdd("anthropic-beta", fmt.Sprintf("%v", v))) } opts = slices.Concat(r.Options, opts) opts = append([]option.RequestOption{option.WithHeader("anthropic-beta", "message-batches-2024-09-24")}, opts...) @@ -152,7 +152,7 @@ func (r *BetaMessageBatchService) Delete(ctx context.Context, messageBatchID str // [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing) func (r *BetaMessageBatchService) Cancel(ctx context.Context, messageBatchID string, body BetaMessageBatchCancelParams, opts ...option.RequestOption) (res *BetaMessageBatch, err error) { for _, v := range body.Betas { - opts = append(opts, option.WithHeaderAdd("anthropic-beta", fmt.Sprintf("%s", v))) + opts = append(opts, option.WithHeaderAdd("anthropic-beta", fmt.Sprintf("%v", v))) } opts = slices.Concat(r.Options, opts) opts = append([]option.RequestOption{option.WithHeader("anthropic-beta", "message-batches-2024-09-24")}, opts...) @@ -179,7 +179,7 @@ func (r *BetaMessageBatchService) ResultsStreaming(ctx context.Context, messageB err error ) for _, v := range query.Betas { - opts = append(opts, option.WithHeaderAdd("anthropic-beta", fmt.Sprintf("%s", v))) + opts = append(opts, option.WithHeaderAdd("anthropic-beta", fmt.Sprintf("%v", v))) } opts = slices.Concat(r.Options, opts) opts = append([]option.RequestOption{option.WithHeader("anthropic-beta", "message-batches-2024-09-24"), option.WithHeader("Accept", "application/x-jsonl")}, opts...) diff --git a/betamodel.go b/betamodel.go index d469795b..863a5a04 100644 --- a/betamodel.go +++ b/betamodel.go @@ -46,7 +46,7 @@ func NewBetaModelService(opts ...option.RequestOption) (r BetaModelService) { // model or resolve a model alias to a model ID. func (r *BetaModelService) Get(ctx context.Context, modelID string, query BetaModelGetParams, opts ...option.RequestOption) (res *BetaModelInfo, err error) { for _, v := range query.Betas { - opts = append(opts, option.WithHeaderAdd("anthropic-beta", fmt.Sprintf("%s", v))) + opts = append(opts, option.WithHeaderAdd("anthropic-beta", fmt.Sprintf("%v", v))) } opts = slices.Concat(r.Options, opts) if modelID == "" { @@ -65,7 +65,7 @@ func (r *BetaModelService) Get(ctx context.Context, modelID string, query BetaMo func (r *BetaModelService) List(ctx context.Context, params BetaModelListParams, opts ...option.RequestOption) (res *pagination.Page[BetaModelInfo], err error) { var raw *http.Response for _, v := range params.Betas { - opts = append(opts, option.WithHeaderAdd("anthropic-beta", fmt.Sprintf("%s", v))) + opts = append(opts, option.WithHeaderAdd("anthropic-beta", fmt.Sprintf("%v", v))) } opts = slices.Concat(r.Options, opts) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) diff --git a/betaskill.go b/betaskill.go index 6191bff5..66f3f043 100644 --- a/betaskill.go +++ b/betaskill.go @@ -47,7 +47,7 @@ func NewBetaSkillService(opts ...option.RequestOption) (r BetaSkillService) { // Create Skill func (r *BetaSkillService) New(ctx context.Context, params BetaSkillNewParams, opts ...option.RequestOption) (res *BetaSkillNewResponse, err error) { for _, v := range params.Betas { - opts = append(opts, option.WithHeaderAdd("anthropic-beta", fmt.Sprintf("%s", v))) + opts = append(opts, option.WithHeaderAdd("anthropic-beta", fmt.Sprintf("%v", v))) } opts = slices.Concat(r.Options, opts) opts = append([]option.RequestOption{option.WithHeader("anthropic-beta", "skills-2025-10-02")}, opts...) @@ -59,7 +59,7 @@ func (r *BetaSkillService) New(ctx context.Context, params BetaSkillNewParams, o // Get Skill func (r *BetaSkillService) Get(ctx context.Context, skillID string, query BetaSkillGetParams, opts ...option.RequestOption) (res *BetaSkillGetResponse, err error) { for _, v := range query.Betas { - opts = append(opts, option.WithHeaderAdd("anthropic-beta", fmt.Sprintf("%s", v))) + opts = append(opts, option.WithHeaderAdd("anthropic-beta", fmt.Sprintf("%v", v))) } opts = slices.Concat(r.Options, opts) opts = append([]option.RequestOption{option.WithHeader("anthropic-beta", "skills-2025-10-02")}, opts...) @@ -76,7 +76,7 @@ func (r *BetaSkillService) Get(ctx context.Context, skillID string, query BetaSk func (r *BetaSkillService) List(ctx context.Context, params BetaSkillListParams, opts ...option.RequestOption) (res *pagination.PageCursor[BetaSkillListResponse], err error) { var raw *http.Response for _, v := range params.Betas { - opts = append(opts, option.WithHeaderAdd("anthropic-beta", fmt.Sprintf("%s", v))) + opts = append(opts, option.WithHeaderAdd("anthropic-beta", fmt.Sprintf("%v", v))) } opts = slices.Concat(r.Options, opts) opts = append([]option.RequestOption{option.WithHeader("anthropic-beta", "skills-2025-10-02"), option.WithResponseInto(&raw)}, opts...) @@ -101,7 +101,7 @@ func (r *BetaSkillService) ListAutoPaging(ctx context.Context, params BetaSkillL // Delete Skill func (r *BetaSkillService) Delete(ctx context.Context, skillID string, body BetaSkillDeleteParams, opts ...option.RequestOption) (res *BetaSkillDeleteResponse, err error) { for _, v := range body.Betas { - opts = append(opts, option.WithHeaderAdd("anthropic-beta", fmt.Sprintf("%s", v))) + opts = append(opts, option.WithHeaderAdd("anthropic-beta", fmt.Sprintf("%v", v))) } opts = slices.Concat(r.Options, opts) opts = append([]option.RequestOption{option.WithHeader("anthropic-beta", "skills-2025-10-02")}, opts...) diff --git a/betaskillversion.go b/betaskillversion.go index 63e52ffc..26115cc7 100644 --- a/betaskillversion.go +++ b/betaskillversion.go @@ -45,7 +45,7 @@ func NewBetaSkillVersionService(opts ...option.RequestOption) (r BetaSkillVersio // Create Skill Version func (r *BetaSkillVersionService) New(ctx context.Context, skillID string, params BetaSkillVersionNewParams, opts ...option.RequestOption) (res *BetaSkillVersionNewResponse, err error) { for _, v := range params.Betas { - opts = append(opts, option.WithHeaderAdd("anthropic-beta", fmt.Sprintf("%s", v))) + opts = append(opts, option.WithHeaderAdd("anthropic-beta", fmt.Sprintf("%v", v))) } opts = slices.Concat(r.Options, opts) opts = append([]option.RequestOption{option.WithHeader("anthropic-beta", "skills-2025-10-02")}, opts...) @@ -61,7 +61,7 @@ func (r *BetaSkillVersionService) New(ctx context.Context, skillID string, param // Get Skill Version func (r *BetaSkillVersionService) Get(ctx context.Context, version string, params BetaSkillVersionGetParams, opts ...option.RequestOption) (res *BetaSkillVersionGetResponse, err error) { for _, v := range params.Betas { - opts = append(opts, option.WithHeaderAdd("anthropic-beta", fmt.Sprintf("%s", v))) + opts = append(opts, option.WithHeaderAdd("anthropic-beta", fmt.Sprintf("%v", v))) } opts = slices.Concat(r.Options, opts) opts = append([]option.RequestOption{option.WithHeader("anthropic-beta", "skills-2025-10-02")}, opts...) @@ -82,7 +82,7 @@ func (r *BetaSkillVersionService) Get(ctx context.Context, version string, param func (r *BetaSkillVersionService) List(ctx context.Context, skillID string, params BetaSkillVersionListParams, opts ...option.RequestOption) (res *pagination.PageCursor[BetaSkillVersionListResponse], err error) { var raw *http.Response for _, v := range params.Betas { - opts = append(opts, option.WithHeaderAdd("anthropic-beta", fmt.Sprintf("%s", v))) + opts = append(opts, option.WithHeaderAdd("anthropic-beta", fmt.Sprintf("%v", v))) } opts = slices.Concat(r.Options, opts) opts = append([]option.RequestOption{option.WithHeader("anthropic-beta", "skills-2025-10-02"), option.WithResponseInto(&raw)}, opts...) @@ -111,7 +111,7 @@ func (r *BetaSkillVersionService) ListAutoPaging(ctx context.Context, skillID st // Delete Skill Version func (r *BetaSkillVersionService) Delete(ctx context.Context, version string, params BetaSkillVersionDeleteParams, opts ...option.RequestOption) (res *BetaSkillVersionDeleteResponse, err error) { for _, v := range params.Betas { - opts = append(opts, option.WithHeaderAdd("anthropic-beta", fmt.Sprintf("%s", v))) + opts = append(opts, option.WithHeaderAdd("anthropic-beta", fmt.Sprintf("%v", v))) } opts = slices.Concat(r.Options, opts) opts = append([]option.RequestOption{option.WithHeader("anthropic-beta", "skills-2025-10-02")}, opts...) diff --git a/completion.go b/completion.go index e5d0c8ce..beaf526c 100644 --- a/completion.go +++ b/completion.go @@ -48,7 +48,7 @@ func NewCompletionService(opts ...option.RequestOption) (r CompletionService) { // Note: If you choose to set a timeout for this request, we recommend 10 minutes. func (r *CompletionService) New(ctx context.Context, params CompletionNewParams, opts ...option.RequestOption) (res *Completion, err error) { for _, v := range params.Betas { - opts = append(opts, option.WithHeaderAdd("anthropic-beta", fmt.Sprintf("%s", v))) + opts = append(opts, option.WithHeaderAdd("anthropic-beta", fmt.Sprintf("%v", v))) } opts = slices.Concat(r.Options, opts) path := "v1/complete" @@ -72,7 +72,7 @@ func (r *CompletionService) NewStreaming(ctx context.Context, params CompletionN err error ) for _, v := range params.Betas { - opts = append(opts, option.WithHeaderAdd("anthropic-beta", fmt.Sprintf("%s", v))) + opts = append(opts, option.WithHeaderAdd("anthropic-beta", fmt.Sprintf("%v", v))) } opts = slices.Concat(r.Options, opts) opts = append(opts, option.WithJSONSet("stream", true)) diff --git a/internal/version.go b/internal/version.go index 25ddc61c..83cb6994 100644 --- a/internal/version.go +++ b/internal/version.go @@ -2,4 +2,4 @@ package internal -const PackageVersion = "1.25.0" // x-release-please-version +const PackageVersion = "1.25.1" // x-release-please-version diff --git a/model.go b/model.go index ea7b0f5b..7552020c 100644 --- a/model.go +++ b/model.go @@ -46,7 +46,7 @@ func NewModelService(opts ...option.RequestOption) (r ModelService) { // model or resolve a model alias to a model ID. func (r *ModelService) Get(ctx context.Context, modelID string, query ModelGetParams, opts ...option.RequestOption) (res *ModelInfo, err error) { for _, v := range query.Betas { - opts = append(opts, option.WithHeaderAdd("anthropic-beta", fmt.Sprintf("%s", v))) + opts = append(opts, option.WithHeaderAdd("anthropic-beta", fmt.Sprintf("%v", v))) } opts = slices.Concat(r.Options, opts) if modelID == "" { @@ -65,7 +65,7 @@ func (r *ModelService) Get(ctx context.Context, modelID string, query ModelGetPa func (r *ModelService) List(ctx context.Context, params ModelListParams, opts ...option.RequestOption) (res *pagination.Page[ModelInfo], err error) { var raw *http.Response for _, v := range params.Betas { - opts = append(opts, option.WithHeaderAdd("anthropic-beta", fmt.Sprintf("%s", v))) + opts = append(opts, option.WithHeaderAdd("anthropic-beta", fmt.Sprintf("%v", v))) } opts = slices.Concat(r.Options, opts) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...)