> For the complete documentation index, see [llms.txt](https://omnitool-ai.gitbook.io/omnitool/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://omnitool-ai.gitbook.io/omnitool/tutorial/blocks/openai.md).

# OpenAI

## Prerequisites

Ensure you have the following before you begin:

* **OpenAI Account**: Sign up or log in at [OpenAI](https://openai.com/).
* **API Token**: Generate your API token on the [OpenAI platform](https://platform.openai.com/api-keys).

<figure><img src="/files/I1kfV2B8afywzIilUZpJ" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/b9KC6wUqoD2r8LTVdi6p" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/Gx69TaRebZNM9HUMBqKr" alt=""><figcaption></figcaption></figure>

## Setup

#### Adding OpenAI API Key

1. Navigate to the **API Key Manager** in the left panel.
2. Enter your OpenAI API token here.

<figure><img src="/files/4XoxxJ08sFk67HxdmmDZ" alt=""><figcaption></figcaption></figure>

## Using OpenAI Blocks

After adding your OpenAI API key, you can access various OpenAI blocks within Omnitool:

1. Go to the "Add Block" collection in Omnitool.
2. Search `openai` namespace

<figure><img src="/files/0rvUUI33Oi3hyTtgDjOO" alt=""><figcaption><p>OpenAI's LLM blocks</p></figcaption></figure>

{% hint style="info" %}
**Access to GPT-4 API**: According to OpenAI, access to the GPT-4 API requires meeting certain criteria as detailed in their [help article](https://help.openai.com/en/articles/7102672-how-can-i-access-gpt-4). If your account is new or lacks sufficient payment history, you may not see the GPT-4 model in the model options.

**Billing Clarification**: The OpenAI API is not the same as ChatGPT Plus billing. Ensure you are accessing the OpenAI Platform API for the correct billing information.

**Credit**: If you haven't added a payment method, make sure you have enough API credits available. Otherwise, you may encounter errors when calling the API. To check your API credit balance, visit [OpenAI Platform Usage](https://platform.openai.com/usage).
{% endhint %}

## Additional Resources

For developers and users seeking more advanced configurations and troubleshooting resources for these blocks, refer to the OpenAPI and block specifications on the <https://github.com/omnitool-ai/omni-core-blocks/tree/main/server/apis/openai>

***

For more detailed information about OpenAI API's offerings and capabilities, visit the [official OpenAI docs](https://platform.openai.com/docs/overview).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://omnitool-ai.gitbook.io/omnitool/tutorial/blocks/openai.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
