Debian Codegraph @

/

debian golang-github-anthropics-anthropic-sdk-go 1.27.1-5debian golang-github-anthropics-anthropic-sdk-go-dev gomod github.com/anthropics/anthropic-sdk-go shell shell-project 0.0.0 debiangogoinijsonmakefilemarkdownshellyaml 170 files · 11931 symbols
View dependency graph

Depends on

README (full)

Claude SDK for Go

Go Reference

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.

Installation

import (
	"github.com/anthropics/anthropic-sdk-go" // imported as anthropic
)

Or explicitly add the dependency:

go get -u 'github.com/anthropics/[email protected]'

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.22+

Contributing

See CONTRIBUTING.md.

License

This project is licensed under the MIT License. See the LICENSE file for details.

dir .devcontainer/
dir .github/
dir bedrock/
dir debian/
dir examples/
dir internal/
dir lib/
dir option/
dir packages/
dir scripts/
dir shared/
dir toolrunner/
dir vertex/
file .gitignore
file .release-please-manifest.json
file .stats.yml
file Brewfile
file CHANGELOG.md
file CONTRIBUTING.md
file LICENSE
file README.md
file SECURITY.md
file aliases.go
file api.md
file beta.go
file betafile.go
file betafile_test.go
file betamessage.go
file betamessage_test.go
file betamessagebatch.go
file betamessagebatch_test.go
file betamessageutil.go
file betamodel.go
file betamodel_test.go
file betaskill.go
file betaskill_test.go
file betaskillversion.go
file betaskillversion_test.go
file betatoolrunner.go
file client.go
file client_test.go
file completion.go
file completion_test.go
file field.go
file go.mod
file go.sum
file message.go
file message_test.go
file messagebatch.go
file messagebatch_test.go
file messageutil.go
file messageutil_test.go
file model.go
file model_test.go
file paginationauto_test.go
file paginationmanual_test.go
file release-please-config.json
file schemautil.go
file schemautil_test.go
file tools.md
file usage_test.go