> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.joytokens.ai/llms.txt.

# Client SDKs

> Call JoyToken public APIs with client SDKs

Client SDKs are for **server-side applications** that call JoyToken directly. They wrap the current public developer APIs (not Console management APIs) and add a bounded, automatic tool-calling loop on top.

Pick a language, install, set two environment variables, and make your first call in under five minutes.

## Choose an SDK

| Language   | Package                                    | Source                                                                                    | Guide                                                  |
| ---------- | ------------------------------------------ | ----------------------------------------------------------------------------------------- | ------------------------------------------------------ |
| TypeScript | `@joytoken/client-sdk-ts`                  | [client-sdk-ts](https://github.com/jd-opensource/joytoken-sdk-ts/tree/main/client-sdk-ts) | [TypeScript SDK](/client-sdk/type-script-sdk/overview) |
| Go         | `github.com/jd-opensource/joytoken-sdk-go` | [joytoken-sdk-go](https://github.com/jd-opensource/joytoken-sdk-go)                       | [Go SDK](/client-sdk/go-sdk/overview)                  |

Runnable example projects: [TypeScript example](https://github.com/jd-opensource/joytoken-sdk-ts/tree/main/example) · [Go example](https://github.com/jd-opensource/joytoken-sdk-go/tree/main/example).

## What you can do

Every capability below links to a complete, copy-and-run example.

| Capability          | TypeScript | Go                  | Where to start                                                                                           |
| ------------------- | ---------- | ------------------- | -------------------------------------------------------------------------------------------------------- |
| Chat Completions    | Supported  | Supported           | [Examples → Chat](/client-sdk/examples#chat-completions)                                                 |
| OpenAI Responses    | Supported  | Supported           | [Examples → Responses](/client-sdk/examples#responses)                                                   |
| Anthropic Messages  | Supported  | Supported           | [Examples → Anthropic](/client-sdk/examples#anthropic-messages)                                          |
| Streaming responses | Supported  | Supported           | [Examples → Streaming](/client-sdk/examples#streaming)                                                   |
| Image generation    | Supported  | Supported           | [API Reference](/open-api/api-guides/overview)                                                           |
| Image editing       | Supported  | Supported           | [API Reference](/open-api/api-guides/overview)                                                           |
| Model list          | Supported  | Supported           | [Examples → Model list](/client-sdk/examples#model-list)                                                 |
| Tool-calling loop   | Automatic  | `RunChatCompletion` | [TS](/client-sdk/type-script-sdk/overview#tool-calling) · [Go](/client-sdk/go-sdk/overview#tool-calling) |
| Error handling      | Supported  | Supported           | [Examples → Errors](/client-sdk/examples#error-handling)                                                 |

> **Note**
>
> Streaming applies to Chat Completions, Responses, and Anthropic Messages. Image generation and editing are non-streaming.

## How the tool-calling loop works

The client SDKs run a **bounded** tool-calling loop over the compatible APIs: when the model returns `tool_calls`, the SDK executes the matching local tools and feeds their results back automatically, repeating until the model returns a final message or the step limit is reached. The safe, zero-config `calculator` and `datetime` tools are injected by default.

See the full tool-calling reference for [TypeScript](/client-sdk/type-script-sdk/overview#tool-calling) or [Go](/client-sdk/go-sdk/overview#tool-calling).

## Required values

You only ever need two things, plus the protocol-specific base URL.

| Item          | Value                                                                  |
| ------------- | ---------------------------------------------------------------------- |
| API key       | `JOY_TOKEN_API_KEY`                                                    |
| API Base URL  | `JOY_TOKEN_API_BASE_URL` from [Environments](/user-guide/environments) |
| Request model | `auto` (not configurable)                                              |

#### OpenAI

Base URL: `JOY_TOKEN_OPENAI_BASE_URL` from [Environments](/user-guide/environments).

#### Anthropic

Base URL: `JOY_TOKEN_ANTHROPIC_BASE_URL` from [Environments](/user-guide/environments).

## Next steps

| Page                                                   | Use it for                                        |
| ------------------------------------------------------ | ------------------------------------------------- |
| [Quickstart](/client-sdk/quickstart)                   | Install and run your first request in 3 steps     |
| [Examples](/client-sdk/examples)                       | Copy full, runnable examples for every capability |
| [TypeScript SDK](/client-sdk/type-script-sdk/overview) | Client options, tool calling, error types         |
| [Go SDK](/client-sdk/go-sdk/overview)                  | Client options, tool calling, error types         |