# OpenAI: credentials

Under Connections, category AI providers, you store an OpenAI Platform API key so workspaces can use Codex and other agents with your account.

> Source: https://www.mainpath.ai/en/docs/openai-credentials/

**OpenAI** lives under **Connections** in the **AI providers** category. The official third-party path is an **API key** from the [OpenAI Platform](https://platform.openai.com). OpenAI does not offer OAuth for API access.

When you create a workspace you pick this connection. The platform writes the key into the workspace environment, configures Codex, and starts the AI agent. MainPath rules and skills are always installed, whether or not you select a key.

You may choose only **one** OpenAI account per workspace; you can combine it with accounts from other providers (Anthropic, Gemini, Mistral, Cursor).

## Store an API key

1. Create a key in the OpenAI Platform under **API keys**.
2. Open **Connections → Add connection → OpenAI**.
3. Enter **Name**, **Slug**, and the **API key**.

The platform checks the key for free against `GET https://api.openai.com/v1/models`. Invalid keys are rejected.

## Use it in a workspace

1. When creating a workspace, select the OpenAI connection under **AI credentials**.
2. After provisioning, `OPENAI_API_KEY` and the Codex configuration are ready in the workspace; code-server restarts with that environment.

