Skip to content

Connecting AI

Before P2Lab AI can do anything, you need to give it credentials for an OpenAI account and tell it which models you want to use. The plugin keeps two related records:

  • A connection — the OpenAI account itself (API key, optional base URL override, last-test status).
  • One or more model configurations — specific models registered against that connection, each with its own pricing, parameters and default task-type bindings.

Throughout the admin, picking the connection-plus-model combination is labelled AI connection.

  1. Open AI Assistant → Settings → Connections.
  2. Click Add connection — the Add AI connection wizard opens.
  3. Fill in:
    • Connection name — a label you will recognise later, e.g. “OpenAI production”.
    • Provider — OpenAI.
    • API key — your OpenAI secret key (sk-...).
    • Base URL (optional) — leave empty to use OpenAI’s default endpoint. Override only if you proxy OpenAI through your own gateway.
  4. Click Next. The plugin pings OpenAI to verify the credentials.

Step 2 — Add one or more model configurations

Section titled “Step 2 — Add one or more model configurations”

A connection without a model configuration can’t run any jobs. In the wizard’s Model configurations step:

  1. Click Add model configuration.
  2. Pick the kind:
    • Chat — for text generation, extraction, translation, etc.
    • Image generation — for image edit jobs.
  3. Pick the model. The dropdown shows everything your account can use (e.g. gpt-4o-mini, gpt-image-1, …).
  4. Fill in Pricing:
    • Input per million tokens — match OpenAI’s published rate for the chosen model.
    • Output per million tokens — same.
    • Web-search call cost — flat fee per web_search tool invocation (chat models only).
    • Image edit cost — flat fee per /images/edits call (image models only).
  5. (Optional) Adjust temperature, top P, max tokens if you want to deviate from OpenAI defaults.
  6. In Default for task types, tick every task this model should handle by default (e.g. generate_seo.product, extract_measures, translate.product, …).
  7. Save the model configuration.

You can add multiple model configurations to the same connection and split tasks between them — for example, a cheaper text model for translations and a stronger one for content generation.

In the wizard’s Review step, you’ll see a summary of the connection and every model configuration. Click the Test button on each model configuration to run a small completion end-to-end and confirm the credentials and pricing work.

You can add more than one connection — useful for separating staging and production accounts, or for running comparison tests. Each connection has its own key, its own models, and its own status. The AI connection dropdown across the admin shows every chat / image_gen model from every connection.

  • “Invalid API key” — the key was rejected by OpenAI. Re-copy it from the OpenAI dashboard.
  • “No models returned” — your OpenAI account has no models available. Check billing on the OpenAI side.
  • Test connection times out — your server can’t reach api.openai.com. Check outbound network rules.

With a connection and at least one model configuration in place, head to First prompt to see the plugin in action.