
Anthropic Go SDK
https://github.com/anthropics/anthropic-sdk-go- Category
- AI Tools
- Rank
- No. 332Tools index
- Pricing
- Open Source
- Type
- TOOL
- Builder
- anthropics
- GitHub
- 1.2k stars
- Latest release
- v1.71.0
- Date
About
Official Go SDK for the Anthropic API — call Claude from Go services with typed responses and streaming.
What it does
It gives Go programs a structured client for conversations, model discovery, token counting, file handling, and a broad beta surface. Request options manage credentials, headers, timeouts, pagination, serialization, and lower-level HTTP access when generated services are insufficient.
Why it's ranked here
A strong default for Go teams using Anthropic because it combines generated API coverage with practical client behavior. Typed error variants, automatic pagination, multipart uploads, configurable authentication, and raw request access reduce integration work without hiding the underlying HTTP model.
What's good
The generated models preserve raw JSON and track field presence, which helps when responses evolve. Typed unions make variant handling explicit. The client supports environment credentials, profiles, federation, custom endpoints, request options, streaming events, automatic pagination, token counting, and undocumented endpoints through generic HTTP methods.
Tradeoffs
It requires Go 1.24 or newer. The module carries substantial direct and indirect dependencies, including AWS, Google, MCP, OAuth, telemetry, and serialization packages. Much of the surface is generated, and research-preview APIs explicitly permit volatile request and response shapes without the usual deprecation period.
How to use it well
Choose it for Go services that need direct, typed control over Anthropic requests and responses. Keep stable message and model work separate from beta integrations, and isolate preview types behind your own interfaces. It handles client-side API integration, not model hosting or the application workflows built around responses.
Technical notes+
README.md documents the module import, API-key setup, Go 1.24 requirement, and MIT license. go.mod declares module github.com/anthropics/anthropic-sdk-go, Go 1.24, a Go 1.25.8 toolchain, and dependencies spanning AWS, Google APIs, MCP, OAuth, JSON schema, pagination support, and test tooling. client.go builds Client with Completions, Messages, Models, and Beta services; DefaultClientOptions implements API key, auth token, profile, federation, base URL, webhook key, and custom-header resolution, while Client.Execute retains authentication, retries, and serialization for undocumented endpoints. message.go implements MessageService.New, MessageService.NewStreaming, and CountTokens, with typed SSE events and calculated non-streaming timeouts. model.go provides get, list, and automatic paging plus capability metadata. beta.go aggregates numerous preview services. betafile.go adds multipart upload, download, metadata, deletion, and pagination. betaagent.go and betadream.go expose generated managed-agent and research-preview dream resources. aliases.go preserves compatibility for renamed public types, while field.go supplies optional-value, pointer, and file helpers.
Observed
- License
- MIT License
- Primary language
- Go
- Packaging
- Go module imported from github.com/anthropics/anthropic-sdk-go and installable with go get
- Interface
- Go client library for the Anthropic HTTP API
- Platform requirement
- Go 1.24 or newer
- Code generation
- Core service and model files state they are generated from an OpenAPI specification by Stainless
Read from README.md, go.mod, beta.go, field.go, model.go, client.go, aliases.go, message.go, betafile.go, betaagent.go, betadream.go.
What it can do
Send messages to Claude AI model
Text prompts and conversation messages → AI-generated text responses
Stream real-time responses from Claude
Text prompts → Streaming text tokens as they're generated
Make typed API calls to Anthropic services
Go function calls with parameters → Structured Go data types with API responses
Configure Claude model parameters
Model settings like temperature, max tokens, system prompts → Configured API request ready for execution
Handle conversation context
Multiple message exchanges with roles → Contextual responses maintaining conversation history
Authenticate with Anthropic API
API credentials and authentication tokens → Authenticated session for API access
Tags
Tech Stack
Comments (0)
No comments yet
Editorially curated, with community endorsements as a secondary signal. Corrections welcome.