# OpenAI Batch connector

The Batch API connector allows you to submit requests for asynchronous batch processing on OpenAI.
You can provide either a JSONL file or a JSON iterator, and the connector handles the upload to OpenAI,
creation of the batch, and downloading of the output and error files.

## Installation

To use the OpenAI Batch connector, run the following command:

```shell
$ pip install flytekitplugins-openai
```

## Example usage

For an example query, see [OpenAI Batch connector example usage](https://www.union.ai/docs/v1/union/integrations/connectors/openai-batch-connector/openai-batch-connector-example-usage-union/page.md)

## Local testing

To test an connector locally, create a class for the connector task that inherits from
[SyncConnectorExecutorMixin](https://github.com/flyteorg/flytekit/blob/1bc8302bb7a6cf4c7048a7f93627ee25fc6b88c4/flytekit/extend/backend/base_connector.py#L304)
or [AsyncConnectorExecutorMixin](https://github.com/flyteorg/flytekit/blob/1bc8302bb7a6cf4c7048a7f93627ee25fc6b88c4/flytekit/extend/backend/base_connector.py#L354).
These mixins can handle synchronous and synchronous tasks, respectively, and allow the SDK to mimic the system's behavior in calling the connector.

For more information, see [Testing connectors locally](https://www.union.ai/docs/v1/union/integrations/connectors/page.md#testing-your-connector-locally).

## Subpages

- [Batching Requests for Asynchronous Processing](https://www.union.ai/docs/v1/union/integrations/connectors/openai-batch-connector/openai-batch-connector-example-usage-union/page.md)

---
**Source**: https://github.com/unionai/unionai-docs/blob/main/content/integrations/connectors/openai-batch-connector/_index.md
**HTML**: https://www.union.ai/docs/v1/union/integrations/connectors/openai-batch-connector/
