https://github.com/anthropics/anthropic-sdk-go
Access to Anthropic's safety-first language model APIs via Go
https://github.com/anthropics/anthropic-sdk-go
Last synced: 4 months ago
JSON representation
Access to Anthropic's safety-first language model APIs via Go
- Host: GitHub
- URL: https://github.com/anthropics/anthropic-sdk-go
- Owner: anthropics
- License: mit
- Created: 2024-07-30T01:13:26.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2026-02-12T23:04:51.000Z (6 months ago)
- Last Synced: 2026-02-13T02:47:33.566Z (6 months ago)
- Language: Go
- Size: 1.39 MB
- Stars: 782
- Watchers: 12
- Forks: 106
- Open Issues: 45
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
- Security: SECURITY.md
Awesome Lists containing this project
- awesome-claude - anthropic-sdk-go
- awesome-managed-agents - Go SDK - Install with `go get github.com/anthropics/anthropic-sdk-go`, requires version 1.33.0 or later. (SDKs)
README
# Claude SDK for Go
The Claude SDK for Go provides access to the [Claude API](https://docs.anthropic.com/en/api/) from Go applications.
## Documentation
Full documentation is available at **[platform.claude.com/docs/en/api/sdks/go](https://platform.claude.com/docs/en/api/sdks/go)**.
## Installation
```go
import (
"github.com/anthropics/anthropic-sdk-go" // imported as anthropic
)
```
Or explicitly add the dependency:
```sh
go get -u 'github.com/anthropics/anthropic-sdk-go@v1.33.0'
```
## Getting started
```go
package main
import (
"context"
"fmt"
"github.com/anthropics/anthropic-sdk-go"
"github.com/anthropics/anthropic-sdk-go/option"
)
func main() {
client := anthropic.NewClient(
option.WithAPIKey("my-anthropic-api-key"), // defaults to os.LookupEnv("ANTHROPIC_API_KEY")
)
message, err := client.Messages.New(context.TODO(), anthropic.MessageNewParams{
MaxTokens: 1024,
Messages: []anthropic.MessageParam{
anthropic.NewUserMessage(anthropic.NewTextBlock("What is a quaternion?")),
},
Model: anthropic.ModelClaudeOpus4_6,
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", message.Content)
}
```
## Requirements
Go 1.22+
## Contributing
See [CONTRIBUTING.md](./CONTRIBUTING.md).
## License
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.