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

# OpenAI

Connect OpenAI as an LLM integration.

OpenAI runs the GPT models.

## Get your credentials

1. Open the [OpenAI API keys page](https://platform.openai.com/api-keys) and sign in (create an account if you have none).
2. Press **Create new secret key**, give it a name such as `norbix-support`, choose the project the cost goes to, and press **Create secret key**.
3. Copy the key (it starts with `sk-`). OpenAI shows it only once. Add a payment method or credits under **Settings → Billing**, or the calls fail.
4. Pick a model from the [models list](https://platform.openai.com/docs/models), for example `gpt-4o-mini`.

More in the provider's own guide: [OpenAI developer quickstart](https://platform.openai.com/docs/quickstart).

## Connect it in Cloud

**Where:** Project → Integrations → LLM → **Add New Integration** → OpenAI → **Connect** · `/projects/<project>/ai/llms/integrations/new/openai`

| Field            | Required | What it does                                                                                                                    | Example                                                             |
| ---------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------- |
| API Key          | yes      | The OpenAI key. Stored encrypted, never shown again.                                                                            | `sk-placeholder-not-a-real-key`                                     |
| Endpoint         | no       | A different address that speaks the OpenAI API — an Azure OpenAI or a self-hosted gateway. Empty = `https://api.openai.com/v1`. | `http://llm.dsai.norbix.test:4010/v1` (the test model of our stack) |
| Default Model    | no       | The model used when a request names none. Empty = the provider's default.                                                       | `gpt-4o-mini`                                                       |
| Integration Name | yes      | How the integration is listed in Norbix.                                                                                        | `Support assistant`                                                 |

<figure><img src="https://712692422-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHy372bqsaex2cqS3ikhL%2Fuploads%2Fgit-blob-a564ed7e21b1f6be17355505d3ae26cb00986a22%2Fopenai-form-1.png?alt=media" alt="New OpenAI Integration form filled with placeholder values"><figcaption><p>The filled form (the key is a made-up placeholder).</p></figcaption></figure>

Press **Save**. The title becomes *Editing OpenAI integration*, the badges say **ENABLED** and **NOT TESTED**, the id (`int_…`) appears with a copy button, the key field is empty again with the note that the key will not be displayed, and the test panel appears at the bottom.

<figure><img src="https://712692422-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHy372bqsaex2cqS3ikhL%2Fuploads%2Fgit-blob-b617b4ab62730c8242cab1955b03b8b060f3490c%2Fopenai-saved-2.png?alt=media" alt="The OpenAI integration after save: badges ENABLED and NOT TESTED, the integration id, and the Test integration panel"><figcaption><p>After save.</p></figcaption></figure>

## Test and set as default

**Test integration** checks only that Norbix can read the stored key; it does not call OpenAI, so a wrong key also passes — see [Test an LLM integration](/codemash/cloud/ai/llm/test.md). Ask the [AI chat](/codemash/cloud/ai/ai-chat.md) a question to check it for real.

The first LLM of an environment gets the **DEFAULT** badge. To make this one the model the AI uses, pick it as the project's **Default LLM** — see [Set the default LLM](/codemash/cloud/ai/llm/set-default.md). To turn it off: [Disable or delete](/codemash/cloud/ai/llm/disable.md).

## Common errors

| Message                                                 | Cause                                                                                                                                                                                                             | Fix                                                                                                     |
| ------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- |
| *Required* under **API Key**                            | The key is empty — it is asked again on every save.                                                                                                                                                               | Type the key again.                                                                                     |
| *Domain URL format is invalid* (`CM-ERRORS-DOMAIN-002`) | **Endpoint** is not a full address.                                                                                                                                                                               | Write it with `http://` or `https://`.                                                                  |
| *Error while running chat turn* when you ask the chat   | The provider refused the call: the key is wrong or was deleted at OpenAI; or no credits on the OpenAI account — Cloud does not show the reason; the server log has it (for example *Status: 401 (Unauthorized)*). | Create a new key, type it in **API Key**, **Save**. Add credits under **Settings → Billing** at OpenAI. |
