Configure OpenAI for PagibleAI

PagibleAI uses OpenAI for structured content refinement and audio transcription by default. You can skip this setup if you do not use either action.

Create a project API key

  1. Sign in to the OpenAI API platform and select the project for this site.
  2. Create a user-owned key for your own development work or a project service account for a shared deployment.
  3. Limit the key to the model and audio permissions PagibleAI needs.
  4. Copy the key to your deployment secret store and set up API billing for the project.

ChatGPT subscriptions do not include API usage. Keep the key on the server and follow OpenAI API key safety practices.

OpenAI developer platform documentation showcasing a JavaScript quickstart guide for making an API request to generate text using a GPT model.
API key management interface for an OpenAI-related service, showing a list of API keys, their details, and options to create, edit, or delete them. API key management interface with a "Create new secret key" dialog open.

Add the key to PagibleAI

OPENAI_API_KEY is an alias. Map it to the two PagibleAI actions that use OpenAI:

OPENAI_API_KEY="..."

CMS_AI_REFINE_API_KEY="${OPENAI_API_KEY}"
CMS_AI_TRANSCRIBE_API_KEY="${OPENAI_API_KEY}"

Run the command below after editing .env, then restart Octane, queue workers and other long-running PHP processes.

php artisan config:clear

Test OpenAI

Refine a short draft content block. The editor should return structured content. Then transcribe a brief, non-sensitive audio file; the result should contain timestamped segments. Small tests keep the cost low.

Troubleshooting

Why does PagibleAI say “No API key”?

Map CMS_AI_REFINE_API_KEY or CMS_AI_TRANSCRIBE_API_KEY to OPENAI_API_KEY. Clear the configuration cache and restart long-running PHP processes.

Why does OpenAI return 401 or a permission error?

Check that the key is active, belongs to the selected project and can use the requested model or audio endpoint. Do not use an organization admin key for normal requests.

Why does OpenAI report insufficient quota?

Check the API project's billing and credit balance. ChatGPT billing is separate.

What if the key was exposed?

Revoke it, deploy a replacement, clear the configuration cache and restart workers. Check project usage for requests you do not recognize.