| name | wp-gravity-connect |
| description | Use when integrating Gravity Forms with OpenAI via Gravity Connect: configuring OpenAI Fields (real-time pre-submission AI) or OpenAI Feeds (async post-submission processing), setting token ceilings, routing through OpenRouter, using GPT Image generation, voice-to-text transcription, or building AI-powered form workflows. |
| license | GPL-2.0-or-later |
| optional | true |
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
GitHub
Fields vs Feeds โ choose the right integration point
| OpenAI Fields | OpenAI Feeds |
|---|
| Trigger | Before submission (real-time) | After submission (async) |
| User waits? | Yes โ keep prompts fast | No โ background processing |
| Use for | Live translation, grammar check, real-time summary, image preview | Email drafts, DB tagging, routing, moderation, classification |
| Token budget | Small (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):
- Install and activate Spellbook from your account dashboard: https://gravitywiz.com/download/spellbook
- In wp-admin: Spellbook โ Connect โ OpenAI Connection โ Install
- Or activate from your account: https://account.gravitywiz.com/
wp plugin install spellbook.zip --activate
2) Connect your OpenAI account
- Create an API key: https://platform.openai.com/api-keys
- In wp-admin: OpenAI Connection โ Settings โ Secret Key โ paste key
- Important: Store in
wp-config.php constant, not the settings UI:
define('OPENAI_API_KEY', getenv('OPENAI_API_KEY'));
3) Configure OpenAI Fields (real-time)
- Form editor โ Advanced Fields โ OpenAI field
- Set Endpoint (Text, Image, Audio)
- Write Prompt using Gravity Forms merge tags:
{field_label:1}, {all_fields}
- Set Maximum Tokens โ always required
4) Configure OpenAI Feeds (post-submission)
- Form โ Settings โ OpenAI
- Add New Feed
- Choose model (e.g.,
gpt-4o-mini for cost efficiency)
- Write prompt with merge tags
- Set Maximum Tokens (required โ see token ceilings below)
- 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.
| Task | Recommended max tokens |
|---|
| Categorization / routing | 50โ100 |
| Email subject line | 50โ75 |
| Email body draft | 200โ400 |
| Summary | 150โ250 |
| Grammar / rewrite | 100โ200 |
| Moderation decision | 50โ100 |
| Image prompt โ image | 256 (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
define('OPENAI_API_KEY', getenv('OPENAI_API_KEY'));
Set alerts in your OpenAI project dashboard for unexpected spend spikes.
References