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

# Use the OpenAI SDK with VoidAI

> Configure OpenAI Python and JavaScript clients for VoidAI chat completions and streaming, with model-specific compatibility guidance.

The OpenAI SDK can call VoidAI's supported OpenAI-compatible endpoints. Set the API base URL to `https://api.voidai.app/v1` and use your VoidAI key. Support for tools, streaming, input modalities, and optional parameters varies by model and endpoint.

## Configure a client

<CodeGroup>
  ```python Python theme={null}
  # pip install openai
  import os
  from openai import OpenAI

  client = OpenAI(
      api_key=os.environ['VOIDAI_API_KEY'],
      base_url='https://api.voidai.app/v1',
  )
  ```

  ```javascript JavaScript theme={null}
  // npm install openai
  import OpenAI from 'openai';

  const client = new OpenAI({
    apiKey: process.env.VOIDAI_API_KEY,
    baseURL: 'https://api.voidai.app/v1',
  });
  ```
</CodeGroup>

## Chat completions

```python theme={null}
response = client.chat.completions.create(
    model='gpt-4o-mini',
    messages=[{'role': 'user', 'content': 'Write a short welcome message.'}],
)
print(response.choices[0].message.content)
```

Choose an exact model ID from the [catalog](/api-reference/models/list) and check your eligibility. A model that supports chat is not necessarily available on every other endpoint.

## Streaming

```python theme={null}
stream = client.chat.completions.create(
    model='gpt-4o-mini',
    messages=[{'role': 'user', 'content': 'Write a short welcome message.'}],
    stream=True,
    stream_options={'include_usage': True},
)
for chunk in stream:
    if chunk.choices:
        print(chunk.choices[0].delta.content or '', end='')
```

Usage-only chunks can have an empty `choices` array. Save the response ID if you need to query [request usage](/api-reference/usage/get).

## Other supported operations

Use the endpoint reference for its request format, constraints, and supported models:

* [Responses](/api-reference/responses/create) and [response compaction](/api-reference/responses/compact)
* [Image generation](/api-reference/images/generations) and [image editing](/api-reference/images/edits)
* [Text-to-speech](/api-reference/audio/speech), [transcription](/api-reference/audio/transcriptions), and [translation](/api-reference/audio/translations)
* [Embeddings](/api-reference/embeddings/create)

For Anthropic-format integrations, use the [Messages endpoint](/api-reference/messages/create). Read its Claude routing disclosure before choosing an integration.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.