AI Assistant

Explain, refactor, and generate Groovy/JavaScript scripts with GPT-4o — right inside the editor.

Availability: AI features require a Pro or Enterprise licence and an OPENAI_API_KEY environment variable set on your CF deployment.

Setup

cf set-env cpi-developer-studio OPENAI_API_KEY "sk-..."
cf set-env cpi-developer-studio OPENAI_MODEL   "gpt-4o"   # optional, default: gpt-4o
cf restage cpi-developer-studio

Once set, the ✨ AI button appears in the Script Editor toolbar and in the Message Log error panel.

Features

Explain Script

Opens a side panel with a plain-English explanation of what the current Groovy/JS script does — step by step. Useful for understanding code written by others or from old projects.

Generate Script

Describe what you want in plain English and the AI writes the Groovy code. Examples:

The generated code is inserted into the editor where your cursor is. Review before saving.

Refactor Script

Paste or select existing code and ask the AI to refactor it for readability, performance, or to follow CPI best practices (proper stream handling, null checks, etc.).

Fix Error

In the Message Log, click ✨ Fix with AI on any failed message. The AI reads the error stack trace and the iFlow's script, then suggests a specific code fix with an explanation.

Privacy & Data

Script content is sent to the OpenAI API using your own API key. CPI Studio does not store or log script content on its servers. Review OpenAI's privacy policy before using AI features with sensitive integration content.

Cost Estimates

ModelCost per ~1000 word scriptBest for
gpt-4o~$0.005Best quality, recommended
gpt-4o-mini~$0.0003High volume / cost-sensitive