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

# OpenAI Provider

> The OpenAI Provider allows for integrating OpenAI's language models into Keep.

<Tip>
  The OpenAI Provider supports querying GPT language models for prompt-based
  interactions.
</Tip>

## Authentication

This provider requires authentication.

* **api\_key**: OpenAI Platform API Key (required: True, sensitive: True)
* **organization\_id**: OpenAI Platform Organization ID (required: False, sensitive: False)

## In workflows

This provider can be used in workflows.

As "step" to query data, example:

```yaml theme={null}
steps:
    - name: Query openai
      provider: openai
      config: "{{ provider.my_provider_name }}"
      with:
        prompt: {value}  
        model: {value}  
        max_tokens: {value}  
        structured_output_format: {value}  
```

Check the following workflow examples:

* [conditionally\_run\_if\_ai\_says\_so.yaml](https://github.com/keephq/keep/blob/main/examples/workflows/conditionally_run_if_ai_says_so.yaml)
* [enrich\_using\_structured\_output\_from\_openai.yaml](https://github.com/keephq/keep/blob/main/examples/workflows/enrich_using_structured_output_from_openai.yaml)
* [gcp\_logging\_open\_ai.yaml](https://github.com/keephq/keep/blob/main/examples/workflows/gcp_logging_open_ai.yaml)
* [send\_slack\_message\_on\_failure.yaml](https://github.com/keephq/keep/blob/main/examples/workflows/send_slack_message_on_failure.yaml)
* [update-incident-grafana-incident.yaml](https://github.com/keephq/keep/blob/main/examples/workflows/update-incident-grafana-incident.yaml)

## Connecting with the Provider

To connect to OpenAI, you'll need to obtain an API Key and (optionally) an Organization ID:

1. Log in to your OpenAI account at [OpenAI Platform](https://platform.openai.com).
2. Go to the **API Keys** section.
3. Click on **Create new secret key** to generate a key for Keep.
4. (Optional) Retrieve your **Organization ID** under **Organization settings** if you’re part of multiple organizations.

Use the generated API key in the `authentication` section of your OpenAI Provider configuration.
