Client SDKs

Client SDKs are for server-side applications that call JoyToken directly. They cover the current public developer APIs, not Console management APIs.

Supported Capabilities

CapabilityTypeScript SDKGo SDK
Chat completionsSupportedSupported
Streaming responsesSupportedSupported
Model listSupportedSupported
Agent loopUse Agent SDKBuild in your app

Required Values

ItemValue
API keyJOY_TOKEN_API_KEY
API Base URLJOY_TOKEN_API_BASE_URL from Environments
OpenAI Base URLJOY_TOKEN_OPENAI_BASE_URL from Environments
Default modelauto

Choose an SDK

LanguagePackagePage
TypeScript@joytoken/client-sdk-tsLeft nav TypeScript SDK
Goclient-sdk-golangLeft nav Go SDK

Minimal TypeScript Call

1import { JoyTokenClient } from "@joytoken/client-sdk-ts";
2
3const joytoken = new JoyTokenClient({
4 apiKey: process.env.JOY_TOKEN_API_KEY,
5 apiBaseUrl: process.env.JOY_TOKEN_API_BASE_URL,
6 openAIBaseUrl: process.env.JOY_TOKEN_OPENAI_BASE_URL,
7});
8
9const completion = await joytoken.chat.completions.create({
10 model: "auto",
11 messages: [{ role: "user", content: "Reply with exactly: pong" }],
12});
13
14console.log(completion.choices[0]?.message?.content);

Minimal Go Call

1client := joytoken.NewClient(
2 joytoken.WithAPIKey(os.Getenv("JOY_TOKEN_API_KEY")),
3 joytoken.WithAPIBaseURL(os.Getenv("JOY_TOKEN_API_BASE_URL")),
4 joytoken.WithOpenAIBaseURL(os.Getenv("JOY_TOKEN_OPENAI_BASE_URL")),
5)
6
7completion, err := client.CreateChatCompletion(ctx, joytoken.ChatCompletionRequest{
8 Model: "auto",
9 Messages: []joytoken.ChatMessage{
10 {Role: "user", Content: "Reply with exactly: pong"},
11 },
12})

Next Steps

PageUse it for
QuickstartRun your first SDK request
ExamplesCopy model-list, streaming, and error-handling examples
Agent SDKUse tools, multi-step runs, and stop conditions