This package contains art, text, or software code produced using generative AI.
This is a module that helps anyone integrate AI. Copilot was also used during its creation.
Integrate AI Module for Foundry VTT
Accelerate AI integration for your Foundry VTT modules with our lightweight, developer-friendly Integrate AI module. This module provides a foundation for connecting your modules to local and remote AI APIs, enabling you to build intelligent, dynamic gameplay experiences without the complexity of API setup.
Developer-Friendly Features:
- Simple API Abstraction: Clean static methods (
processWithAIandchatWithAI) that handle all HTTP communication and JSON parsing for you. - Configuration Management: Built-in settings system with
game.settings.registerfor base URL and model selection, making your module's AI integration configurable by world creators. - Modular Design: Easy-to-use class structure (
IntegrateAI) that can be extended or imported into any module with minimal overhead. - Error Handling: Comprehensive error management built-in, with detailed console logging for debugging AI interactions.
- Flexible Integration: Works with any AI API that supports the standard generate/chat endpoints (e.g., Ollama, OpenAI).
Quick Integration:
Simply import the module and use the provided static methods to connect to your AI backend:
const response = await IntegrateAI.processWithAI("Generate a fantasy creature description");
const chatResponse = await IntegrateAI.chatWithAI([{
role: "user",
content: "What is the weather like?"
}]);
Example Modules:
Perfect for Module Developers:
Whether you're building an NPC dialogue system, automated quest generator, or intelligent world-building tool, this module gives you the foundation to seamlessly integrate AI capabilities into your Foundry VTT modules. No more reinventing the wheel – focus on your creative vision, not API complexity.
Having trouble getting it working?
Missing a feature you want?
*Currently this module is for use with Ollama, OpenAI requires further testing.