# Flex processing

Beta

Optimize costs with flex processing.

Flex processing provides lower costs for
[Responses](https://platform.openai.com/docs/api-reference/responses) or
[Chat Completions](https://platform.openai.com/docs/api-reference/chat) requests
in exchange for slower response times and occasional resource unavailability.
It's ideal for non-production or lower priority tasks, such as model
evaluations, data enrichment, and asynchronous workloads.

Tokens are [priced](https://platform.openai.com/docs/pricing) at
[Batch API rates](https://platform.openai.com/docs/guides/batch), with
additional discounts from
[prompt caching](https://platform.openai.com/docs/guides/prompt-caching).

Flex processing is in beta and currently only available for
[GPT-5](https://platform.openai.com/docs/models/gpt-5),
[o3](https://platform.openai.com/docs/models/o3), and
[o4-mini](https://platform.openai.com/docs/models/o4-mini) models.

## API usage

To use Flex processing, set the `service_tier` parameter to `flex` in your API
request:

```javascript
import OpenAI from "openai";
const client = new OpenAI({
  timeout: 15 * 1000 * 60, // Increase default timeout to 15 minutes
});

const response = await client.responses.create(
  {
    model: "o3",
    instructions: "List and describe all the metaphors used in this book.",
    input: "<very long text of book here>",
    service_tier: "flex",
  },
  { timeout: 15 * 1000 * 60 },
);

console.log(response.output_text);
```

```python
from openai import OpenAI
client = OpenAI(
    # increase default timeout to 15 minutes (from 10 minutes)
    timeout=900.0
)