mcpField
W
wp-gravity-connect

wp-gravity-connect

github.com/kylebrodeurDevelopment149 installsUpdated 1w ago
Repository

About wp-gravity-connect

wp-gravity-connect documents integrating Gravity Forms with OpenAI for form-time and post-submission AI tasks. It covers text, image, and audio workflows, plus token limits and OpenRouter routing.

Key features

  1. 01Real-time AI fields in forms
  2. 02Asynchronous post-submission feeds
  3. 03Text, image, and audio tasks
  4. 04OpenRouter model routing
  5. 05Token and API cost controls

Use cases

  1. 01Drafting or classifying submitted entries
  2. 02Moderating form submissions
  3. 03Generating images from form data
  4. 04Transcribing voice input in forms

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/kylebrodeur/wordpress-agent-kit --skill wp-gravity-connect

After installing, type/wp-gravity-connectin Claude Code to confirm it loaded.

Details

From the project README

Gravity Connect — OpenAI Integration

Gravity Connect (OpenAI Connection) integrates Gravity Forms directly with OpenAI for AI text generation, image creation, voice transcription, and automated entry processing. Part of the Gravity Wiz ecosystem, installed via Spellbook.

When to use

  • Setting up AI text generation inside a form (before submission)
  • Configuring post-submission AI processing (email drafting, classification, tagging)
  • Building AI-powered form moderation
  • Generating images with GPT Image from form data
  • Voice-to-text transcription in forms
  • Routing prompts through OpenRouter for model hot-swapping
  • Setting token limits to control API costs

Official documentation

ResourceURL
Gravity Connect docshttps://gravitywiz.com/documentation/gravity-connect/
OpenAI Connection docshttps://gravitywiz.com/documentation/gravity-connect-openai/
Fields referencehttps://gravitywiz.com/documentation/gravity-connect-openai/#fields
Feeds referencehttps://gravitywiz.com/documentation/gravity-connect-openai/#feeds
GPT Image guidehttps://gravitywiz.com/how-to-generate-ai-images-in-gravity-forms/
AI text generationhttps://gravitywiz.com/generate-text-gravity-forms-openai/
AI moderationhttps://gravitywiz.com/gravity-forms-moderation-gc-openai/
Social media automationhttps://gravitywiz.com/spotlight-social-media-gravity-forms-openai/
Installation (via Spellbook)https://gravitywiz.com/documentation/spellbook/
Account dashboardhttps://account.gravitywiz.com/
Supporthttps://gravitywiz.com/support/

GitHub


Fields vs Feeds — choose the right integration point

OpenAI FieldsOpenAI Feeds
TriggerBefore submission (real-time)After submission (async)
User waits?Yes — keep prompts fastNo — background processing
Use forLive translation, grammar check, real-time summary, image previewEmail drafts, DB tagging, routing, moderation, classification
Token budgetSmall (user is waiting)Larger acceptable

Rule: Default to Feeds unless the use case requires real-time display before the user submits.


Procedure

1) Install via Spellbook

Gravity Connect is not a standalone plugin — it installs through Spellbook (the Gravity Wiz platform):

  1. Install and activate Spellbook from your account dashboard: https://gravitywiz.com/download/spellbook
  2. In wp-admin: Spellbook → Connect → OpenAI Connection → Install
  3. Or activate from your account: https://account.gravitywiz.com/
# After downloading Spellbook zip
wp plugin install spellbook.zip --activate
# Then install OpenAI Connection from the Spellbook UI in wp-admin
2) Connect your OpenAI account
  1. Create an API key: https://platform.openai.com/api-keys
  2. In wp-admin: OpenAI Connection → Settings → Secret Key → paste key
  3. Important: Store in wp-config.php constant, not the settings UI:
// wp-config.php
define('OPENAI_API_KEY', getenv('OPENAI_API_KEY'));
3) Configure OpenAI Fields (real-time)
  1. Form editor → Advanced Fields → OpenAI field
  2. Set Endpoint (Text, Image, Audio)
  3. Write Prompt using Gravity Forms merge tags: {field_label:1}, {all_fields}
  4. Set Maximum Tokens — always required
4) Configure OpenAI Feeds (post-submission)
  1. Form → Settings → OpenAI
  2. Add New Feed
  3. Choose model (e.g., gpt-4o-mini for cost efficiency)
  4. Write prompt with merge tags
  5. Set Maximum Tokens (required — see token ceilings below)
  6. Map the AI response to a field or send via notification merge tag
5) Token ceilings — always set

Every feed and field must have Maximum Tokens set to prevent runaway costs.

TaskRecommended max tokens
Categorization / routing50–100
Email subject line50–75
Email body draft200–400
Summary150–250
Grammar / rewrite100–200
Moderation decision50–100
Image prompt → image256 (tokens don't apply to image size)
6) OpenRouter — hot-swap models without code changes

Route through OpenRouter to use cheaper open-source models:

OpenAI Connection → Settings → Custom Base URL:
  https://openrouter.ai/api/v1

Model examples:
  meta-llama/llama-3-8b-instruct  (cheap, fast)
  anthropic/claude-3-haiku         (quality, affordable)
  mistralai/mistral-7b-instruct    (open source)

Use cheaper models for tagging/categorization feeds; expensive models only when quality matters.

7) GPT Image generation

Field type: OpenAI → Image. Add to form for pre-submission image preview or post-submission image storage.

Prompt: "Professional headshot of {Name:1}, corporate style, white background"
Size: 1024x1024
Store URL in: Image Field 5

Security and cost controls

// wp-config.php — credentials in constants, not wp_options
define('OPENAI_API_KEY', getenv('OPENAI_API_KEY'));

// Set spending limits in OpenAI Platform dashboard:
// https://platform.openai.com/account/limits

Set alerts in your OpenAI project dashboard for unexpected spend spikes.

References

Comments

Markdown supported