Skip to content

feat: add Go SDK#18

Merged
Germey merged 1 commit intomainfrom
feat/go-sdk
Apr 27, 2026
Merged

feat: add Go SDK#18
Germey merged 1 commit intomainfrom
feat/go-sdk

Conversation

@acedatacloud-dev
Copy link
Copy Markdown
Member

Summary

Add an official Go SDK at go/ mirroring the designs of the existing Python and TypeScript SDKs.

What's in it

  • Client with functional options (WithAPIToken, WithBaseURL, WithPaymentHandler, WithTimeout, WithMaxRetries, WithHeaders, WithHTTPClient)
  • Resources
    • OpenAIChat().Completions().Create / CreateStream, Responses().Create / CreateStream
    • ChatMessages().Create / CreateStream / CountTokens
    • ImagesGenerate (returns a *TaskHandle for polling)
    • TasksGet / Wait across ~16 services
  • Transport — exponential-backoff retry on 408/409/429/5xx, parses typed errors from error.code
  • TaskHandle.Wait — polls until response.status is succeeded or failed
  • PaymentHandler hook — invoked on 402 Payment Required (integration point for the companion X402Client Go package)
  • Typed errors*AuthenticationError, *RateLimitError, *ValidationError, *InsufficientBalanceError, *ResourceDisabledError, *ModerationError, *TimeoutError, *TransportError

Module

github.com/AceDataCloud/SDK/go, Go 1.21+, tag-based releases (no third-party registry).

Testing

cd go
go vet ./...
go test ./... -race -count=1

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.yaml runs 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.Z for nested modules) so go get github.com/AceDataCloud/SDK/go@v0.1.0 resolves.

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.
@Germey Germey merged commit 50dc199 into main Apr 27, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants