Client SDKs
Client SDKs are for server-side applications that call JoyToken directly. They cover the current public developer APIs, not Console management APIs.
Client SDKs are for server-side applications that call JoyToken directly. They cover the current public developer APIs, not Console management APIs.
| Capability | TypeScript SDK | Go SDK |
|---|---|---|
| Chat completions | Supported | Supported |
| Streaming responses | Supported | Supported |
| Model list | Supported | Supported |
| Agent loop | Use Agent SDK | Build in your app |
| Item | Value |
|---|---|
| API key | JOY_TOKEN_API_KEY |
| API Base URL | JOY_TOKEN_API_BASE_URL from Environments |
| OpenAI Base URL | JOY_TOKEN_OPENAI_BASE_URL from Environments |
| Default model | auto |
| Language | Package | Page |
|---|---|---|
| TypeScript | @joytoken/client-sdk-ts | Left nav TypeScript SDK |
| Go | client-sdk-golang | Left nav Go SDK |
1 import { JoyTokenClient } from "@joytoken/client-sdk-ts"; 2 3 const 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 9 const completion = await joytoken.chat.completions.create({ 10 model: "auto", 11 messages: [{ role: "user", content: "Reply with exactly: pong" }], 12 }); 13 14 console.log(completion.choices[0]?.message?.content);
1 client := 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 7 completion, err := client.CreateChatCompletion(ctx, joytoken.ChatCompletionRequest{ 8 Model: "auto", 9 Messages: []joytoken.ChatMessage{ 10 {Role: "user", Content: "Reply with exactly: pong"}, 11 }, 12 })
| Page | Use it for |
|---|---|
| Quickstart | Run your first SDK request |
| Examples | Copy model-list, streaming, and error-handling examples |
| Agent SDK | Use tools, multi-step runs, and stop conditions |