Gdevlop AI Connector#2101
Open
github-actions[bot] wants to merge 1 commit intomainfrom
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Connections to many AIs such as Hugging Face, Open Router, Gemini, Groq or your own API and AI's
How to use the extension
This repository contains a set of Custom Actions for GDevelop. No coding is required! Simply add these actions to your project to connect your game to the world's most powerful AI models.⚠️ Security & Production Info
🌟 Supported Providers & Features
1. OpenRouter (Recommended)
All-in-One: Access Llama, Mistral, Claude, and GPT through one interface.
Get Key: openrouter.ai
Best Free Models: google/gemma-2-9b-it:free, meta-llama/llama-3.2-3b-instruct:free
2. Groq (Ultra Fast)
Speed: The fastest response times for real-time NPC dialogue.
Get Key: console.groq.com
Models: llama-3.3-70b-versatile, llama-3.1-8b-instant
3. Google Gemini
Smart: High reasoning capabilities and large context.
Get Key: aistudio.google.com
4. Hugging Face
Open Source: Great for community models and specific specialized AIs.
Get Key: huggingface.co/settings/tokens
🚀 How to use in GDevelop
Since these are Custom Actions, you just need to fill in the parameters in the Events Sheet:
Add the Action: Search for your AI Suite actions in the event editor.
Fill the Parameters:
API_Key: Your secret key (e.g., sk-or-v1-...).
Message (Personality): Define how the AI should act (e.g., "You are a shopkeeper").
TextInput: The variable or string containing the player's message.
Scene_Variable: The name of the variable where the AI's answer will be stored.
Model: The model ID (e.g., google/gemma-2-9b-it:free).
URL (Only for Universal/Custom AI action): The endpoint URL.
Important: This extension is ideal for prototypes and Game Jams. The API key is stored inside the client-side game files.
For commercial projects, a Server Proxy is recommended to keep your keys hidden.
🛠️ Setting up a Server Proxy (Optional)
To protect your keys in a professional release:
Create a simple backend: Use Node.js or Python (hosted on Vercel or Render).
Hide the Key: Store your API Key in the server's environment variables.
Communication: GDevelop calls your server -> Your server adds the Key and calls the AI -> Your server returns the answer.
Result: Your secret API Key never leaves your secure server.
💡 Troubleshooting
Failed to Fetch: If you are testing in a browser and it fails, try the GDevelop Desktop App. Desktop apps bypass most CORS (security) restrictions that browsers enforce.
No Response: Ensure your API Key is active and you have confirmed your phone number/email with the provider (especially Mistral and Gemini).
Trimming: These actions automatically clean up accidental spaces in your keys and model names.
Checklist
AI usage
Example file
Exampleaiextension.zip
Extension file
AIConnector.zip
Extension by @stumblespike
You can update the extension on this "Pull Request" by commenting the update command: in the comment field, type
!update, then drag and drop a zip file with your extension file in the commenting field, like how you initially submitted the extension. It should look like this:It can take a few seconds for the file to fully upload and show as the above. Once it is like shown above, click "Comment" and let the bot do the rest!