Star 历史趋势
数据来源: GitHub API · 生成自 Stargazers.cn
README.md

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/anthropic-sdk-go@v1.56.0'

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.

License

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

关于 About

Access to Anthropic's safety-first language model APIs via Go

语言 Languages

Go99.8%
Shell0.2%
Ruby0.0%

提交活跃度 Commit Activity

代码提交热力图
过去 52 周的开发活跃度
341
Total Commits
峰值: 23次/周
Less
More

核心贡献者 Contributors