Merged
Conversation
Add official Go SDK at go/ mirroring the Python and TypeScript SDKs. - Top-level Client with functional options (WithAPIToken, WithBaseURL, WithPaymentHandler, WithTimeout, WithMaxRetries, WithHeaders, WithHTTPClient) - Resources: OpenAI (chat.completions + responses, streaming), Chat (messages.create + count_tokens, streaming), Images (generate — returns TaskHandle for polling), Tasks (get + wait across ~16 services) - Transport with exponential-backoff retry on 408/409/429/5xx - TaskHandle.Wait polling abstraction for long-running image/audio/video - Pluggable PaymentHandler hook invoked on 402 Payment Required (integration point for x402-client) - Typed error hierarchy (AuthenticationError, RateLimitError, ValidationError, InsufficientBalanceError, ModerationError, etc.) - Go 1.21+ module at github.com/AceDataCloud/SDK/go CI: go.yaml workflow runs tests on Go 1.21 / 1.22 / 1.23 with race detector.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add an official Go SDK at
go/mirroring the designs of the existing Python and TypeScript SDKs.What's in it
WithAPIToken,WithBaseURL,WithPaymentHandler,WithTimeout,WithMaxRetries,WithHeaders,WithHTTPClient)OpenAI→Chat().Completions().Create/CreateStream,Responses().Create/CreateStreamChat→Messages().Create/CreateStream/CountTokensImages→Generate(returns a*TaskHandlefor polling)Tasks→Get/Waitacross ~16 serviceserror.coderesponse.statusissucceededorfailed402 Payment Required(integration point for the companion X402Client Go package)*AuthenticationError,*RateLimitError,*ValidationError,*InsufficientBalanceError,*ResourceDisabledError,*ModerationError,*TimeoutError,*TransportErrorModule
github.com/AceDataCloud/SDK/go, Go 1.21+, tag-based releases (no third-party registry).Testing
Unit tests cover: client construction, 503 retry, typed error mapping, string-shaped 402 error body, 402 → PaymentHandler → retry-with-X-Payment flow, TaskHandle.Wait polling, Images.Generate → TaskHandle wiring.
CI
New
.github/workflows/go.yamlruns Go 1.21 / 1.22 / 1.23 matrix with race detector.Release
After merge, tag
go/v0.1.0(Go modules expect<subdir>/vX.Y.Zfor nested modules) sogo get github.com/AceDataCloud/SDK/go@v0.1.0resolves.