Skip to content

Gdevlop AI Connector #2100

@stumblespike

Description

@stumblespike

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.
​🌟 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.
⚠️ Security & Production Info
​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

  • I've followed all of the best practices.
  • I confirm that this extension can be integrated to this GitHub repository, distributed and MIT licensed.
  • I am aware that the extension may be updated by anyone, and do not need my explicit consent to do so.

AI usage

  • I used an AI to generate some part of the code.
  • I don't understand the generated code or I don't feel able to modify it.

Example file

Exampleaiextension.zip

Extension file

AIConnector.zip

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions