Go SDK
github.com/joytoken/client-sdk-golang is a small Go client for JoyToken’s public developer API. It wraps Chat Completions, streaming Chat Completions, model listing, API key headers, default base URLs, and structured API errors.
Install
Configure
client.go
Defaults:
Chat Completions
chat.go
Streaming
stream.go
JoyToken can send a metadata event near the end of a stream. Check whether Choices is present before rendering content.
Models
models.go
Error handling
errors.go
APIError includes the HTTP status, request ID, and raw body. Use it for logging and retry decisions.
Custom client
custom-client.go