Skip to content

Commit b65404e

Browse files
committed
Merge upstream/main into main, keep Nordlys-Labs import paths
2 parents a51b47e + 4794d52 commit b65404e

38 files changed

+2351
-717
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
2121

2222
steps:
23-
- uses: actions/checkout@v4
23+
- uses: actions/checkout@v6
2424

2525
- name: Setup go
2626
uses: actions/setup-go@v5
@@ -35,7 +35,7 @@ jobs:
3535
runs-on: ${{ github.repository == 'stainless-sdks/anthropic-go' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
3636
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
3737
steps:
38-
- uses: actions/checkout@v4
38+
- uses: actions/checkout@v6
3939

4040
- name: Setup go
4141
uses: actions/setup-go@v5

.github/workflows/claude.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Claude Code
2+
3+
on:
4+
issue_comment:
5+
types: [created]
6+
pull_request_review_comment:
7+
types: [created]
8+
issues:
9+
types: [opened, assigned]
10+
pull_request_review:
11+
types: [submitted]
12+
13+
jobs:
14+
claude:
15+
if: |
16+
(github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
17+
(github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) ||
18+
(github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) ||
19+
(github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')))
20+
runs-on: ubuntu-latest
21+
permissions:
22+
contents: read
23+
pull-requests: read
24+
issues: read
25+
id-token: write
26+
actions: read # Required for Claude to read CI results on PRs
27+
steps:
28+
- name: Checkout repository
29+
uses: actions/checkout@v4
30+
with:
31+
fetch-depth: 1
32+
33+
- name: Run Claude Code
34+
id: claude
35+
uses: anthropics/claude-code-action@v1
36+
with:
37+
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
38+
39+
# This is an optional setting that allows Claude to read CI results on PRs
40+
additional_permissions: |
41+
actions: read
42+
43+
# Optional: Give a custom prompt to Claude. If this is not specified, Claude will perform the instructions specified in the comment that tagged it.
44+
# prompt: 'Update the pull request description to include a summary of changes.'
45+
46+
# Optional: Add claude_args to customize behavior and configuration
47+
# See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
48+
# or https://code.claude.com/docs/en/cli-reference for available options
49+
# claude_args: '--allowed-tools Bash(gh pr:*)'
50+

.github/workflows/create-releases.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
environment: production-release
1515

1616
steps:
17-
- uses: actions/checkout@v4
17+
- uses: actions/checkout@v6
1818

1919
- uses: stainless-api/trigger-release-please@v1
2020
id: release

.github/workflows/detect-breaking-changes.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
run: |
1616
echo "FETCH_DEPTH=$(expr ${{ github.event.pull_request.commits }} + 1)" >> $GITHUB_ENV
1717
18-
- uses: actions/checkout@v4
18+
- uses: actions/checkout@v6
1919
with:
2020
# Ensure we can check out the pull request base in the script below.
2121
fetch-depth: ${{ env.FETCH_DEPTH }}

.release-please-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "1.19.0"
2+
".": "1.22.1"
33
}

.stats.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 34
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/anthropic%2Fanthropic-a49e89deec4e00d1da490808099d66e2001531b12d8666a7f5d0b496f760440d.yml
3-
openapi_spec_hash: c93ef3808c58e233b01966ff154f31ce
4-
config_hash: 7e9dfe17ab5c80abee5372ce746a926e
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/anthropic%2Fanthropic-fee5dc365a4948e68639582c5301d4d0666c7d85a11628d7917e1477f76d3da1.yml
3+
openapi_spec_hash: d5543958074cd2bd74096cd69f3bb4f9
4+
config_hash: 8739bb23213865e8ad45a32ba99a4de1

CHANGELOG.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,68 @@
11
# Changelog
22

3+
## 1.22.1 (2026-02-10)
4+
5+
Full Changelog: [v1.22.0...v1.22.1](https://github.com/anthropics/anthropic-sdk-go/compare/v1.22.0...v1.22.1)
6+
7+
### Bug Fixes
8+
9+
* **encoder:** correctly serialize NullStruct ([1435f8a](https://github.com/anthropics/anthropic-sdk-go/commit/1435f8ac4d272561c7e689cc6bb4e3794414ba57))
10+
11+
## 1.22.0 (2026-02-07)
12+
13+
Full Changelog: [v1.21.0...v1.22.0](https://github.com/anthropics/anthropic-sdk-go/compare/v1.21.0...v1.22.0)
14+
15+
### Features
16+
17+
* **api:** enabling fast-mode in claude-opus-4-6 ([ebe6433](https://github.com/anthropics/anthropic-sdk-go/commit/ebe6433768cab86dcc02b71159aaa347a8d473ec))
18+
19+
## 1.21.0 (2026-02-05)
20+
21+
Full Changelog: [v1.20.0...v1.21.0](https://github.com/anthropics/anthropic-sdk-go/compare/v1.20.0...v1.21.0)
22+
23+
### Features
24+
25+
* **api:** Release Claude Opus 4.6, adaptive thinking, and other features ([e899e64](https://github.com/anthropics/anthropic-sdk-go/commit/e899e64cd402eb004909d632e68acc4b0587f53c))
26+
27+
28+
### Chores
29+
30+
* **ci:** remove claude-code-review workflow ([31db702](https://github.com/anthropics/anthropic-sdk-go/commit/31db70249f691b161f326f550dc26cdcce54dd30))
31+
32+
## 1.20.0 (2026-01-29)
33+
34+
Full Changelog: [v1.19.0...v1.20.0](https://github.com/anthropics/anthropic-sdk-go/compare/v1.19.0...v1.20.0)
35+
36+
### Features
37+
38+
* **api:** add support for Structured Outputs in the Messages API ([10c3821](https://github.com/anthropics/anthropic-sdk-go/commit/10c382188df98d7b045aec525bdc47f3df25d576))
39+
* **api:** migrate sending message format in output_config rather than output_format ([f996db4](https://github.com/anthropics/anthropic-sdk-go/commit/f996db402bc1f868b11d877014a6c51d977c557f))
40+
* **client:** add a convenient param.SetJSON helper ([427514e](https://github.com/anthropics/anthropic-sdk-go/commit/427514ea6dde81f4eb374967577b5a4cf380f627))
41+
* **encoder:** support bracket encoding form-data object members ([eaaeadf](https://github.com/anthropics/anthropic-sdk-go/commit/eaaeadf6dd67119ca4406f0fb0337c16d9011b8f))
42+
43+
44+
### Bug Fixes
45+
46+
* **accumulator:** revert to marshal accumulator on stop events ([#563](https://github.com/anthropics/anthropic-sdk-go/issues/563)) ([096a8a8](https://github.com/anthropics/anthropic-sdk-go/commit/096a8a8b20b530359c214e06272938bcf8a98c59))
47+
* **client:** retain streaming when user sets request body ([6d073fe](https://github.com/anthropics/anthropic-sdk-go/commit/6d073fe49f351c26c7f3fa8337e661c6a3600c68))
48+
* **docs:** add missing pointer prefix to api.md return types ([23aaf6d](https://github.com/anthropics/anthropic-sdk-go/commit/23aaf6de59f0c13c79dbe4fc1d764b47cfd83834))
49+
* **mcp:** correct code tool API endpoint ([6c8a083](https://github.com/anthropics/anthropic-sdk-go/commit/6c8a0831e6f084d316179a9288c4fa1c5420ea59))
50+
* rename param to avoid collision ([6d1cf75](https://github.com/anthropics/anthropic-sdk-go/commit/6d1cf75d5a407d5eb19c70e3778ab82bca74d0d5))
51+
* streaming endpoints should pass through errors correctly ([e584c87](https://github.com/anthropics/anthropic-sdk-go/commit/e584c87ec001ee8991ca17b8236a6ef3deb78ea7))
52+
* **to-param:** remove panics and add cases ([#524](https://github.com/anthropics/anthropic-sdk-go/issues/524)) ([f689816](https://github.com/anthropics/anthropic-sdk-go/commit/f6898163047854d39cec7c08ec5ab993bab463fc))
53+
54+
55+
### Chores
56+
57+
* add float64 to valid types for RegisterFieldValidator ([b6bec73](https://github.com/anthropics/anthropic-sdk-go/commit/b6bec73c5ed18698884b990fc3dc6398a3784177))
58+
* **ci:** Add Claude Code GitHub Workflow ([a151836](https://github.com/anthropics/anthropic-sdk-go/commit/a151836056343974d15eda64180fc776ba0f169d))
59+
* **client:** improve example values ([8af69b8](https://github.com/anthropics/anthropic-sdk-go/commit/8af69b851f4a60334ed75542c2eacbe69c01893c))
60+
* **client:** mark claude-3-5-haiku as deprecated ([dcac65c](https://github.com/anthropics/anthropic-sdk-go/commit/dcac65c8dd82f232c2997456319c16357874f37b))
61+
* elide duplicate aliases ([c8e2ee1](https://github.com/anthropics/anthropic-sdk-go/commit/c8e2ee14de53b5636eadccb2a890e4464e30b8d4))
62+
* **internal:** codegen related update ([931c976](https://github.com/anthropics/anthropic-sdk-go/commit/931c9769f1ff0557a8eff333463e1847b15f7953))
63+
* **internal:** update `actions/checkout` version ([3bd83ec](https://github.com/anthropics/anthropic-sdk-go/commit/3bd83eca53f1ec0b759c2568601286405821dcbc))
64+
* **internal:** use different example values for some enums ([f2d46b8](https://github.com/anthropics/anthropic-sdk-go/commit/f2d46b87de1a57ed1790cad3134b5e340f22fd73))
65+
366
## 1.19.0 (2025-11-24)
467

568
Full Changelog: [v1.18.1...v1.19.0](https://github.com/anthropics/anthropic-sdk-go/compare/v1.18.1...v1.19.0)

README.md

Lines changed: 67 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Or to pin the version:
2626
<!-- x-release-please-start-version -->
2727

2828
```sh
29-
go get -u 'github.com/Nordlys-Labs/anthropic-sdk-go@v1.19.0'
29+
go get -u 'github.com/Nordlys-Labs/anthropic-sdk-go@v1.22.1'
3030
```
3131

3232
<!-- x-release-please-end -->
@@ -59,7 +59,7 @@ func main() {
5959
Messages: []anthropic.MessageParam{
6060
anthropic.NewUserMessage(anthropic.NewTextBlock("What is a quaternion?")),
6161
},
62-
Model: anthropic.ModelClaudeOpus4_5_20251101,
62+
Model: anthropic.ModelClaudeSonnet4_5_20250929,
6363
})
6464
if err != nil {
6565
panic(err.Error())
@@ -571,9 +571,9 @@ _, err := client.Messages.New(context.TODO(), anthropic.MessageNewParams{
571571
MaxTokens: 1024,
572572
Messages: []anthropic.MessageParam{{
573573
Content: []anthropic.ContentBlockParamUnion{{
574-
OfText: &anthropic.TextBlockParam{Text: "What is a quaternion?", CacheControl: anthropic.CacheControlEphemeralParam{TTL: anthropic.CacheControlEphemeralTTLTTL5m}, Citations: []anthropic.TextCitationParamUnion{{
575-
OfCharLocation: &anthropic.CitationCharLocationParam{CitedText: "cited_text", DocumentIndex: 0, DocumentTitle: anthropic.String("x"), EndCharIndex: 0, StartCharIndex: 0},
576-
}}},
574+
OfText: &anthropic.TextBlockParam{
575+
Text: "x",
576+
},
577577
}},
578578
Role: anthropic.MessageParamRoleUser,
579579
}},
@@ -610,11 +610,13 @@ client.Messages.New(
610610
MaxTokens: 1024,
611611
Messages: []anthropic.MessageParam{{
612612
Content: []anthropic.ContentBlockParamUnion{{
613-
OfRequestTextBlock: &anthropic.TextBlockParam{Text: "What is a quaternion?"},
613+
OfText: &anthropic.TextBlockParam{
614+
Text: "What is a quaternion?",
615+
},
614616
}},
615617
Role: anthropic.MessageParamRoleUser,
616618
}},
617-
Model: anthropic.ModelClaudeOpus4_5_20251101,
619+
Model: anthropic.ModelClaudeSonnet4_5_20250929,
618620
},
619621
// This sets the per-retry timeout
620622
option.WithRequestTimeout(20*time.Second),
@@ -680,11 +682,13 @@ client.Messages.New(
680682
MaxTokens: 1024,
681683
Messages: []anthropic.MessageParam{{
682684
Content: []anthropic.ContentBlockParamUnion{{
683-
OfRequestTextBlock: &anthropic.TextBlockParam{Text: "What is a quaternion?"},
685+
OfText: &anthropic.TextBlockParam{
686+
Text: "What is a quaternion?",
687+
},
684688
}},
685689
Role: anthropic.MessageParamRoleUser,
686690
}},
687-
Model: anthropic.ModelClaudeOpus4_5_20251101,
691+
Model: anthropic.ModelClaudeSonnet4_5_20250929,
688692
},
689693
option.WithMaxRetries(5),
690694
)
@@ -704,13 +708,13 @@ message, err := client.Messages.New(
704708
MaxTokens: 1024,
705709
Messages: []anthropic.MessageParam{{
706710
Content: []anthropic.ContentBlockParamUnion{{
707-
OfText: &anthropic.TextBlockParam{Text: "What is a quaternion?", CacheControl: anthropic.CacheControlEphemeralParam{TTL: anthropic.CacheControlEphemeralTTLTTL5m}, Citations: []anthropic.TextCitationParamUnion{{
708-
OfCharLocation: &anthropic.CitationCharLocationParam{CitedText: "cited_text", DocumentIndex: 0, DocumentTitle: anthropic.String("x"), EndCharIndex: 0, StartCharIndex: 0},
709-
}}},
711+
OfText: &anthropic.TextBlockParam{
712+
Text: "x",
713+
},
710714
}},
711715
Role: anthropic.MessageParamRoleUser,
712716
}},
713-
Model: anthropic.ModelClaudeOpus4_5_20251101,
717+
Model: anthropic.ModelClaudeSonnet4_5_20250929,
714718
},
715719
option.WithResponseInto(&response),
716720
)
@@ -835,7 +839,56 @@ func main() {
835839

836840
If you already have an `aws.Config`, you can also use it directly with `bedrock.WithConfig(cfg)`.
837841

838-
Read more about Anthropic and Amazon Bedrock [here](https://docs.anthropic.com/en/api/claude-on-amazon-bedrock).
842+
### Bearer Token Authentication
843+
844+
You can also authenticate with Bedrock using bearer tokens instead of AWS credentials. This is useful in corporate environments where teams need access to Bedrock without managing AWS credentials, IAM roles, or account-level permissions.
845+
846+
The simplest approach is to set the `AWS_BEARER_TOKEN_BEDROCK` environment variable:
847+
848+
```go
849+
package main
850+
851+
import (
852+
"context"
853+
854+
"github.com/anthropics/anthropic-sdk-go"
855+
"github.com/anthropics/anthropic-sdk-go/bedrock"
856+
)
857+
858+
func main() {
859+
// Automatically uses AWS_BEARER_TOKEN_BEDROCK from the environment.
860+
// Region defaults to us-east-1 or uses AWS_REGION if set.
861+
client := anthropic.NewClient(
862+
bedrock.WithLoadDefaultConfig(context.Background()),
863+
)
864+
}
865+
```
866+
867+
To provide a token programmatically, use `bedrock.WithConfig` with a `BearerAuthTokenProvider`:
868+
869+
```go
870+
package main
871+
872+
import (
873+
"context"
874+
875+
"github.com/anthropics/anthropic-sdk-go"
876+
"github.com/anthropics/anthropic-sdk-go/bedrock"
877+
"github.com/aws/aws-sdk-go-v2/aws"
878+
)
879+
880+
func main() {
881+
cfg := aws.Config{
882+
Region: "us-west-2",
883+
BearerAuthTokenProvider: bedrock.NewStaticBearerTokenProvider("your-bearer-token"),
884+
}
885+
client := anthropic.NewClient(
886+
bedrock.WithConfig(cfg),
887+
)
888+
}
889+
```
890+
891+
Read more about Anthropic and Amazon Bedrock [here](https://docs.anthropic.com/en/api/claude-on-amazon-bedrock) and about Bedrock API keys [here](https://docs.aws.amazon.com/bedrock/latest/userguide/api-keys-use.html).
839892

840893
## Google Vertex AI
841894

0 commit comments

Comments
 (0)