# OpenAI and ElevenLabs SDKs

> Connecting the official OpenAI and ElevenLabs SDKs for Python and Node.

The official SDKs work with the gateway without code changes — set the base URL
and the key.

## OpenAI SDK

```python [Python]
from openai import OpenAI

client = OpenAI(base_url="https://llmbox.cc/v1", api_key="$LLMBOX_API_KEY")
resp = client.chat.completions.create(
    model="openai/gpt-5.6-sol",
    messages=[{"role": "user", "content": "Hello!"}],
)
print(resp.choices[0].message.content)
```

```ts [Node]
import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://llmbox.cc/v1",
  apiKey: "$LLMBOX_API_KEY",
});
const resp = await client.chat.completions.create({
  model: "openai/gpt-5.6-sol",
  messages: [{ role: "user", content: "Hello!" }],
});
console.log(resp.choices[0].message.content);
```

Without parameters the client reads the `OPENAI_BASE_URL` and `OPENAI_API_KEY`
variables:

```bash
export OPENAI_BASE_URL=https://llmbox.cc/v1
export OPENAI_API_KEY=$LLMBOX_API_KEY
```

The same client works with [Responses](https://llmbox.cc/en/docs/responses)
(`client.responses.create`) and [images](https://llmbox.cc/en/docs/images)
(`client.images.generate`).

## ElevenLabs SDK

The official ElevenLabs SDK works with the [audio endpoints](https://llmbox.cc/en/docs/audio).
`base_url` is the gateway address without `/v1`; the SDK sends the key in `xi-api-key`.

```python [Python]
from elevenlabs.client import ElevenLabs

client = ElevenLabs(base_url="https://llmbox.cc", api_key="$LLMBOX_API_KEY")
voices = client.voices.search(page_size=5)
print([v.name for v in voices.voices])
```

```ts [Node]
import { ElevenLabsClient } from "@elevenlabs/elevenlabs-js";

const client = new ElevenLabsClient({
  baseUrl: "https://llmbox.cc",
  apiKey: "$LLMBOX_API_KEY",
});
const voices = await client.voices.search({ pageSize: 5 });
console.log(voices.voices.map((v) => v.name));
```

## Retries and timeouts

- The OpenAI SDK retries `429` and `5xx` itself, honoring the
  `Retry-After` header — no extra retry code needed. The ElevenLabs Node SDK
  retries too (the `maxRetries` option, 2 by default).
- What is left of the requests-per-minute limit is in the response headers
  `x-ratelimit-limit-requests`, `x-ratelimit-remaining-requests` and
  `x-ratelimit-reset-requests` (see [Limits](https://llmbox.cc/en/docs/limits)).
- For images, video and reasoning models increase the client timeout:
  generation may take minutes.
