Bring AI to your Foundry VTT table with powerful OpenAI integration. Whether you prefer simple Chat Completions or sophisticated Assistants with custom knowledge bases, this module adapts to your needs.
- Get your API key from OpenAI
- Install the module using:
https://github.com/marccosta12/foundryvtt_SmartChatAI/releases/latest/download/module.json - Configure settings with your API key and preferred AI engine
- Start asking! Use
/?or/w gptin chat
Use /? when you want to share the AI response with all players at the table.
/? what's the cost of standing up from prone?
Visible to: All players
Response: Standing up from prone costs half of your movement speed.
Use /w gpt for questions you don't want players to see (plot details, damage calculations, secrets). Only the sender and GM will see both the question and response.
/w gpt time to don and doff armor
Visible to: Sender + GM
Response: According to the rules in the Player's Handbook, donning and doffing armor takes:
| Armor Type | Donning Time | Doffing Time |
|---|---|---|
| Light Armor | 1 minute | 1 minute |
| Medium Armor | 5 minutes | 1 minute |
| Heavy Armor | 10 minutes | 5 minutes |
| Shield | 1 action | 1 action |
Include specific players: You can also whisper to specific players by name:
/w [gpt, PlayerName] can I counterspell this effect?
- Chat Completions API - Fast, lightweight, great for quick rules lookups and inspiration
- Assistants API - Powerful, with custom knowledge bases and persistent context (bring your own Assistant ID)
Built-in support for D&D 5e, Pathfinder 2e and generic systems. Customize prompts for any ruleset.
Maintain conversation history across multiple turns. Adjust context window size to balance memory and token usage.
- Select model version (GPT-4o, GPT-4o Mini, or GPT-3.5)
- Customize system prompts for your campaign
- Configure context length for conversation memory
- Optional: Use your custom OpenAI Assistant for advanced features
The module intercepts /? and /w gpt commands in Foundry VTT chat and sends them to your chosen OpenAI API. Responses are formatted with proper Markdown support and integrated into your game's chat log.
Your custom prompts determine how the AI behaves—whether it acts as a knowledgeable GM assistant, rules adjudicator, or creative inspiration engine. The AI understands rulesets for popular game systems but always benefits from additional context in custom prompts.
💡 Security Tip: Like all Foundry modules, settings are visible to players with console access. For shared games, we recommend creating a dedicated OpenAI API key with spending limits at OpenAI Dashboard. This way you can safely share AI features while controlling costs.
| Setting | Description | Default |
|---|---|---|
| OpenAI API Key | Your OpenAI API key (required). Generate at OpenAI Platform | - |
| Game System | Auto-detect or choose: D&D 5e, Pathfinder 2e or Generic | Auto-detect |
| Custom Prompt | Optional. Replaces the Game system prompt to customize AI behavior | System default |
| GPT Model Version | Choose the OpenAI model. Higher versions give better results but cost more | gpt-4o-mini |
| Context Length | Number of recent messages AI remembers (0-50). Per-user, resets on page reload | 5 |
| OpenAI Assistant ID | Advanced. Uses your custom OpenAI Assistant. See Using Assistants below | - |
Don't have an Assistant? Create one on OpenAI Platform:
If you find Smart Chat AI useful, consider supporting its development:
Your support helps maintain the module and add new features!
Maintainer: Marc Costa - Added Assistants API support, refactored architecture, and ongoing development.
Special thanks to:
- Nikolay Vizovitin - Built the foundation that made this project possible
- OpenAI - For incredible AI tools
- Foundry VTT community - For the amazing platform