Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/anthropics/anthropic-sdk-go
/ functions
Functions
17,396 in github.com/anthropics/anthropic-sdk-go
⨍
Functions
17,396
◇
Types & classes
5,294
↓ 8 callers
Method
Download
Download File When the returned error is an [*apierror.Error], compare the [apierror.Error.ErrorCode] against these values. - [ErrorCodeClaudeCodeKe
file.go:123
↓ 8 callers
Method
End
(...trace.SpanEndOption)
client_test.go:1284
↓ 8 callers
Function
ExchangeFederationAssertion
ExchangeFederationAssertion performs an OAuth 2.0 jwt-bearer exchange against the Anthropic token endpoint and returns the minted credentials. Federa
config/federation.go:144
↓ 8 callers
Method
GetType
Returns a pointer to the underlying variant's property, if present.
betamessage.go:21861
↓ 8 callers
Method
IsRecording
()
internal/tracing/attributes_test.go:176
↓ 8 callers
Function
NewTokenCache
NewTokenCache returns a [TokenCache] that delegates to the given provider. The handler is passed through to the provider on every fetch; the base URL
internal/auth/cache.go:52
↓ 8 callers
Function
ProfileCredentialsPath
ProfileCredentialsPath returns the path to credentials/<profile>.json under dir.
config/writers.go:147
↓ 8 callers
Method
SetExtraFields
SetExtraFields adds extra fields to the JSON object. SetExtraFields will override any existing fields with the same key. For security reasons, ensure
packages/param/param.go:157
↓ 8 callers
Method
SetLoseUploadResponses
(lose bool)
lib/environments/memories_test.go:160
↓ 8 callers
Function
ValueOf
ValueOf gives the default value of a constant from its type. It's helpful when constructing constants as variants in a one-of. Note that empty structs
shared/constant/constants.go:27
↓ 8 callers
Method
asAny
()
betamessage.go:14619
↓ 8 callers
Function
betaRequest
betaRequest returns the request that a middleware gets from a beta method that posts body to v1/messages.
lib/betafallback/betafallback_test.go:127
↓ 8 callers
Method
blockedOn
(thread string)
betasessiontoolrunner_fake_test.go:1075
↓ 8 callers
Method
deliverInOneChunk
deliverInOneChunk makes the runner read all queued events at once, and its first read does not wait.
betasessiontoolrunner_fake_test.go:818
↓ 8 callers
Method
dispatch
dispatch polls and acks the item with token_0, for a worker's HandleItem.
environmentworker_fake_test.go:269
↓ 8 callers
Function
downloadedMode
downloadedMode is downloadedStores with a SyncDeletions mode and a fake clock at time zero.
lib/environments/memories_test.go:1671
↓ 8 callers
Function
fallbackParams
fallbackParams are params that name fallbackModel as a fallback.
betamessagethreadutil_test.go:278
↓ 8 callers
Function
isSpace
(c byte)
internal/encoding/json/scanner.go:199
↓ 8 callers
Function
isolateProfileEnv
(t *testing.T)
internal/auth/integration_test.go:1619
↓ 8 callers
Function
mustStores
mustStores is NewSessionMemoryStores for options a test knows are valid.
lib/environments/memories_test.go:460
↓ 8 callers
Function
newTurnRunnerOver
(thread *BetaMessageThread, stream bool, tools ...BetaTool)
betatoolrunnerthread_test.go:691
↓ 8 callers
Function
requeuedAndClaimed
(now float64)
environmentworker_test.go:61
↓ 8 callers
Function
requireStatus
(t *testing.T, status int, err error)
workpoller_test.go:57
↓ 8 callers
Method
resolveUnderRoot
(rel string)
internal/filestore/filestore.go:347
↓ 8 callers
Function
resultJSON
(call anthropic.DispatchedToolCall)
betasessiontoolrunner_test.go:148
↓ 8 callers
Method
resumeTerminatedThread
resumeTerminatedThread is late input that makes the subagent's terminated thread run again.
betasessiontoolrunner_fake_test.go:745
↓ 8 callers
Function
runTraced
(t *testing.T, steps schedule, opts runOptions, client ...option.RequestOption)
betasessiontoolrunner_test.go:2097
↓ 8 callers
Function
saveCredentials
(t *testing.T, accessToken string, expiresIn time.Duration)
internal/auth/integration_test.go:1655
↓ 8 callers
Function
secretOf
(token string)
environmentworker_fake_test.go:728
↓ 8 callers
Method
sendResult
(id string)
betasessiontoolrunner_fake_test.go:690
↓ 8 callers
Function
spanNamed
(t *testing.T, recorder *spanRecorder, name string)
betasessiontoolrunner_test.go:2108
↓ 8 callers
Function
speedKeys
speedKeys lists the speed each request body carried, absent for a body without the key.
lib/betafallback/betafallback_test.go:1325
↓ 8 callers
Function
target
(ev event)
betasessiontoolrunner_fake_test.go:1303
↓ 8 callers
Method
then
(other schedule)
betasessiontoolrunner_fake_test.go:468
↓ 8 callers
Method
toParam
()
betamessageutil.go:363
↓ 8 callers
Method
typeEncoder
(t reflect.Type)
internal/apiquery/encoder.go:44
↓ 8 callers
Function
wantSize
wantSize fails the test unless size is the length of the values of the content attributes in attrs.
internal/telemetry/content_test.go:97
↓ 8 callers
Function
weatherThreadParams
Runner over a thread.
betatoolrunnerthread_test.go:673
↓ 8 callers
Function
withClock
withClock swaps in a fake clock at time zero and returns a handle to it.
lib/environments/memories_test.go:559
↓ 8 callers
Function
writeMessagesResponse
writeMessagesResponse writes a canned successful Messages API response.
bedrock/bedrockmantle_test.go:41
↓ 7 callers
Function
ActiveConfigPath
ActiveConfigPath returns the path to the active_config pointer file under dir.
config/writers.go:152
↓ 7 callers
Method
AddTools
AddTools gives the model more tools without changing Params.Tools, which keeps the prompt cache. Each definition goes out with the next request. The r
betatoolrunner.go:233
↓ 7 callers
Function
BetaAgentToolset20260401
BetaAgentToolset20260401 returns the six built-in agent_toolset_20260401 implementations bound to env, in the anthropic.BetaTool shape the SDK's tool
tools/agenttoolset/agenttoolset.go:126
↓ 7 callers
Function
EnvCredentials
EnvCredentials resolves OIDC-federation credentials from environment variables. Returns a usable result when the three required vars are all set. Othe
internal/auth/default.go:25
↓ 7 callers
Function
ResolveConfig
ResolveConfig resolves all configuration values from ClientConfig fields and environment variable fallbacks, parameterized by ResolveParams.
internal/awsauth/awsauth.go:77
↓ 7 callers
Function
SigV4Middleware
SigV4Middleware returns an HTTP middleware that signs requests using AWS SigV4 with the given service name.
internal/awsauth/awsauth.go:226
↓ 7 callers
Method
ToParam
()
betamessageutil.go:311
↓ 7 callers
Function
WithOpenTelemetryTraces
WithOpenTelemetryTraces returns a RequestOption that turns the OpenTelemetry spans of API calls, and the trace-context headers of their requests, on o
option/tracing.go:45
↓ 7 callers
Function
WithResponseBodyInto
WithResponseBodyInto returns a RequestOption that overwrites the deserialization target with the given destination. If provided, we don't deserialize
option/requestoption.go:348
↓ 7 callers
Method
applyStep
(s step)
betasessiontoolrunner_fake_test.go:1507
↓ 7 callers
Function
betaContentParams
()
opentelemetry_content_test.go:381
↓ 7 callers
Method
credentials
()
environmentworker_fake_test.go:158
↓ 7 callers
Method
emit
(eventType string, data []byte)
lib/betafallback/streaming.go:270
↓ 7 callers
Function
ended
(span sdktrace.ReadOnlySpan)
opentelemetry_test.go:102
↓ 7 callers
Method
headers
(name string)
environmentworker_fake_test.go:162
↓ 7 callers
Function
markedUserJSON
(text string)
betamessagethreadutil_test.go:206
↓ 7 callers
Function
newCappedRunnerParams
(maxIterations int)
betatoolrunner_test.go:1229
↓ 7 callers
Function
outputMessages
outputMessages returns gen_ai.output.messages of one message, which has parts.
internal/telemetry/content_test.go:46
↓ 7 callers
Function
performingWork
(actions ...[]workerAction)
environmentworker_properties_test.go:350
↓ 7 callers
Function
readCredentialsFile
(path string)
internal/auth/credentials_file.go:30
↓ 7 callers
Function
requireBackoffs
(t *testing.T, want []float64, attempts []float64)
betasessiontoolrunner_test.go:105
↓ 7 callers
Function
requireLocalError
requireLocalError requires an error that did not come from a response.
betamessagethreadutil_test.go:324
↓ 7 callers
Function
returning
(name string, content blocks, err error)
betasessiontoolrunner_test.go:135
↓ 7 callers
Function
runToToolResults
runToToolResults drives the runner to completion and returns every tool_result block it appended to the conversation.
betatoolrunner_test.go:83
↓ 7 callers
Function
sentHeaders
sentHeaders builds a client from clientOpts, sends one request with reqOpts, and returns the headers that reached the server.
option/requestoption_test.go:221
↓ 7 callers
Function
stateEndValue
stateEndValue is the state after completing a value, such as after reading `{}` or `true` or `["x"`.
internal/encoding/json/scanner.go:279
↓ 7 callers
Method
status
()
betasessiontoolrunner_fake_test.go:863
↓ 7 callers
Function
stubAdditionJSON
stubAdditionJSON is the tool_addition block AddTools sends for a stubBetaTool.
betatoolrunner_test.go:503
↓ 7 callers
Function
summaryJSON
()
betatoolrunnerthread_test.go:39
↓ 7 callers
Function
textCutOff
textCutOff is a stream that drops inside the text block of reply id, after text.
betamessagethreadutil_test.go:1910
↓ 7 callers
Method
tool
(label string)
betatoolrunner_test.go:392
↓ 7 callers
Method
typeEncoder
(t reflect.Type)
internal/apiform/encoder.go:78
↓ 7 callers
Function
unmarshalBetaContentBlockParam
(t *testing.T, jsonData string)
betamessageutil_test.go:13
↓ 7 callers
Function
weatherTool
(t *testing.T)
toolrunner/runner_test.go:56
↓ 7 callers
Function
withShell
(t *testing.T, limit, calls int)
betasessiontoolrunner_test.go:304
↓ 7 callers
Method
withoutClientRetries
()
environmentworker_test.go:77
↓ 7 callers
Function
writtenByFallback
writtenByFallback returns response as fallbackModel writes it: the content starts with a fallback block, and the usage has a fallback_message entry.
betamessagethreadutil_test.go:251
↓ 6 callers
Method
AsFallback
()
betamessage.go:10458
↓ 6 callers
Method
Close
Close kills the shell and its background jobs, and removes the saved output. Safe to call multiple times.
tools/agenttoolset/bash.go:394
↓ 6 callers
Function
CompareGolden
CompareGolden compares the given string with the golden file at path. If UPDATE_GOLDEN=1, it overwrites the file with the provided contents.
internal/testutil/golden.go:11
↓ 6 callers
Method
Do
(*http.Request)
option/requestoption.go:178
↓ 6 callers
Method
Err
()
packages/ssestream/ssestream.go:20
↓ 6 callers
Method
Exec
Exec runs cmd in the persistent shell and returns its output and exit code. The output is stdout and then stderr, or stderr first if cmd failed. A tim
tools/agenttoolset/bash.go:247
↓ 6 callers
Method
GetNextPage
GetNextPage returns the next page as defined by this pagination style. When there is no next page, this function will return a 'nil' for the page valu
packages/pagination/pagination.go:48
↓ 6 callers
Function
IsNull
IsNull returns true if v was set to the JSON value null. To set a param to null use [NullStruct], [Null], [NullMap], or [NullSlice] depending on the
packages/param/param.go:79
↓ 6 callers
Function
MarshalWithExtras
MarshalWithExtras is used to marshal a struct with additional properties. Stability for the API of MarshalWithExtras is not guaranteed.
packages/param/encoder.go:43
↓ 6 callers
Method
New
Create a Credential
betavaultcredential.go:45
↓ 6 callers
Method
New
Create Deployment
betadeployment.go:45
↓ 6 callers
Function
NewBashSession
NewBashSession starts bash in dir. env selects the base environment for the spawned shell. When nil the shell inherits the runner's environment minus
tools/agenttoolset/bash.go:97
↓ 6 callers
Function
NewClient
NewClient generates a new client with the default option read from the environment (ANTHROPIC_API_KEY, ANTHROPIC_WEBHOOK_SIGNING_KEY, ANTHROPIC_AUTH_T
client.go:242
↓ 6 callers
Function
NewMiddleware
NewMiddleware returns bearer-auth middleware serving tokens from cache. Tokens are exchanged at, and only attached to requests for, cfg.BaseURL — a re
internal/auth/middleware.go:33
↓ 6 callers
Function
NewReportPageCursorAutoPager
(page *ReportPageCursor[T], err error)
packages/pagination/pagination.go:570
↓ 6 callers
Function
NewUserOAuthAuthentication
NewUserOAuthAuthentication returns a populated [AuthenticationInfo] for the user_oauth variant. Pass an empty clientID to describe a profile whose acc
config/config.go:196
↓ 6 callers
Method
Post
Post makes a POST request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and respons
client.go:309
↓ 6 callers
Method
Raw
()
internal/apijson/field.go:23
↓ 6 callers
Method
ResultsStreaming
Streams the results of a Message Batch as a `.jsonl` file. Each line in the file is a JSON object containing the result of a single request in the Me
messagebatch.go:226
↓ 6 callers
Method
SetResponseBodyInto
SetResponseBodyInto makes dst the value that the SDK decodes the body of the response into, as NewRequestConfig does with its own. A next page calls i
internal/requestconfig/otel.go:207
↓ 6 callers
Method
SpanContext
()
opentelemetry_test.go:1743
↓ 6 callers
Function
ValidateRequestPath
ValidateRequestPath returns an error if u, a URL or a path, fails [url.Parse] or would be sent with a path segment that is "." or "..", or has nothing
internal/requestconfig/url.go:22
↓ 6 callers
Function
WithHeaderDel
WithHeaderDel returns a RequestOption that deletes the header value(s) associated with the given key.
option/requestoption.go:259
← previous
next →
401–500 of 17,396, ranked by callers