> ## Documentation Index
> Fetch the complete documentation index at: https://docs.icelake.io/llms.txt
> Use this file to discover all available pages before exploring further.

# OpenAI SDK

> Use the official OpenAI Node and Python clients with Icelake.

Only the base URL and API key change.

## TypeScript

```ts theme={null}
import OpenAI from "openai";

const client = new OpenAI({
  apiKey: process.env.ICELAKE_API_KEY,
  baseURL: "https://chat.icelake.io/api/v1",
});

const stream = await client.chat.completions.create({
  model: "zai-org-glm-5-2",
  stream: true,
  messages: [{ role: "user", content: "Stream a short poem" }],
});

for await (const chunk of stream) {
  process.stdout.write(chunk.choices[0]?.delta?.content ?? "");
}
```

## Python

```python theme={null}
from openai import OpenAI
import os

client = OpenAI(
    api_key=os.environ["ICELAKE_API_KEY"],
    base_url="https://chat.icelake.io/api/v1",
)

completion = client.chat.completions.create(
    model="zai-org-glm-5-2",
    messages=[{"role": "user", "content": "Hello"}],
)
print(completion.choices[0].message.content)
```

## Images

```ts theme={null}
const image = await client.images.generate({
  model: "auto",
  prompt: "A crystalline lake under aurora",
  // @ts-expect-error response_format may vary by SDK version
  response_format: "b64_json",
});
```
