anthropics/anthropic-sdk-go
Go
Captured source
source ↗published Jul 30, 2024seen 6dcaptured 9hhttp 200method plain
anthropics/anthropic-sdk-go
Description: Access to Anthropic's safety-first language model APIs via Go
Language: Go
License: MIT
Stars: 1091
Forks: 185
Open issues: 86
Created: 2024-07-30T01:13:26Z
Pushed: 2026-06-09T23:55:08Z
Default branch: main
Fork: no
Archived: no
README:
Claude SDK for Go
The Claude SDK for Go provides access to the Claude 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
import ( "github.com/anthropics/anthropic-sdk-go" // imported as anthropic )
Or explicitly add the dependency:
go get -u 'github.com/anthropics/anthropic-sdk-go@v1.50.1'
Getting started
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.24+
Contributing
See [CONTRIBUTING.md](./CONTRIBUTING.md).
License
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
Notability
notability 6.0/10Official Anthropic SDK for Go with moderate stars.