Client SDKs

JoyToken Client SDKs are thin clients over the public developer API. They handle authentication headers, request typing, streaming parsing, model listing, and normalized API errors while keeping application orchestration in your code.

SDKs

LanguagePackage / moduleBest for
TypeScript@joytoken/client-sdk-tsNode.js services, Next.js backend routes, agent runtimes, and workers
Gogithub.com/joytoken/client-sdk-golangGo services, background workers, and internal tools

Both SDKs cover the same public API surface:

CapabilitySDK methodEndpoint
Chat Completionschat.completions.create() / CreateChatCompletion()POST /openai/v1/chat/completions
Streaming Chat Completionschat.completions.stream() / StreamChatCompletion()POST /openai/v1/chat/completions
Model catalogmodels.list() / ListModels()GET /api/v1/models

Install

$pnpm add @joytoken/client-sdk-ts

Quick example

1import { JoyTokenClient } from "@joytoken/client-sdk-ts";
2
3const client = new JoyTokenClient({
4 apiKey: process.env.JOY_TOKEN_API_KEY,
5});
6
7const response = await client.chat.completions.create({
8 model: "auto",
9 messages: [
10 { role: "user", content: "Explain JoyToken in one sentence." },
11 ],
12});
13
14console.log(response.choices[0]?.message?.content);

When to use Client SDKs

Choose a Client SDK when your application owns the orchestration and you want a typed model-call client.

Use caseWhy the Client SDK fits
Direct model callsOne call in, one model response out
Streaming UISDK parses server-sent events and exposes chunks
Service-side wrappersCentralize API key, base URL, timeout, and request ID handling
Agent runtimesUse Client SDKs as the model provider layer under your own loop
Model pickerRead the public model catalog from GET /api/v1/models

Client SDKs vs Agent SDK

Client SDKsAgent SDK
FocusTyped API clientsMulti-step agent runtime
Model callsYou call chat completions directlyAgent SDK calls the model provider
ToolsYour app dispatches tool callsAgent SDK dispatches registered tools
StateYour app stores messages and checkpointsYour app still owns persistence, Agent SDK manages the run loop
LanguagesTypeScript, GoTypeScript

Next steps

PageContents
Usage for AgentsHow coding assistants should use JoyToken SDK knowledge
TypeScript SDKInstall, configure, call, stream, and handle errors
TypeScript API ReferenceExported classes, methods, and core types
Go SDKInstall, configure, call, stream, and handle errors
Go API ReferenceClient options, methods, stream, errors, and types