Skip to content

feat(ai): Bring Your Own Key (BYOK) & local/custom model support - #8986

Open
BillyOutlast wants to merge 5 commits into
4ian:masterfrom
Heretek-AI:master
Open

feat(ai): Bring Your Own Key (BYOK) & local/custom model support#8986
BillyOutlast wants to merge 5 commits into
4ian:masterfrom
Heretek-AI:master

Conversation

@BillyOutlast

Copy link
Copy Markdown

Description

Addresses #7932 and #8854.

This PR adds an opt-in Bring Your Own Key (BYOK) & Custom / Local AI Endpoint feature to GDevelop, allowing game creators to connect any OpenAI-compatible API endpoint (such as local servers like Ollama, llama.cpp, LM Studio, or remote providers like OpenAI, OpenRouter, Azure OpenAI, Groq, DeepSeek, etc.) to the GDevelop AI Assistant and Standalone Creation Form.


Key Highlights & Features

  • OpenAI-Compatible Client (CustomAIClient.js):

    • Implements standard chat completion requests (/chat/completions) with tool calling support.
    • Automatically translates GDevelop's internal conversation and editor tool format into standard OpenAI tool calls and schemas.
    • Handles reasoning models (extracts <think> tags and reasoning_content).
    • Supports cancellation via AbortSignal / CancelToken.
  • Comprehensive Tool Calling Support:

    • Supports all GDevelop editor tool functions (scene creation, object creation, layer/effects modification, instance placement in 2D and 3D, behavior management, event generation, variable management, and sandboxed script execution).
  • Preferences & Configuration UI:

    • Added a new Custom / Local AI Endpoint (BYOK) section in IDE Preferences.
    • Configure Base URL, API Key (stored in memory/session only, never persisted in cleartext localStorage), Model Name, and Temperature (0.0–1.0).
    • Includes an integrated "Test Connection" button that tests /models or a lightweight completion to verify connectivity and lists available models.
  • 100% Opt-in & Non-Breaking:

    • Disabled by default: When disabled, GDevelop continues to use the official cloud Generation API and existing subscription/credit mechanisms without any change.
    • Clean request routing: Local BYOK requests and events are identified by prefix (local-ai-*, local-evt-*), leaving cloud-hosted request handling completely intact.

Issues Addressed


Testing & Verification

  • Added unit test suite in CustomAIClient.spec.js covering configuration, URL normalization, message transformation, tool parsing, thinking extraction, and request lifecycle.
  • Tested against local Ollama (qwen2.5-coder, llama3.2) and OpenAI endpoints.
  • Validated with the full test suite (npm test -- --watchAll=false).

John Smith and others added 5 commits August 19, 2026 15:27
…oint support

- Add CustomAIClient with full OpenAI chat completions, reasoning/thinking extraction, tool calling, and local request caching
- Add complete tool schemas and robust argument extractors for all 29 GDevelop editor functions
- Add AI Settings tab in Preferences to configure custom endpoint URL, API Key, Model ID, temperature, and streaming
- Bypass cloud subscription/credit entitlement gates and S3 presigned URL uploads when custom endpoint is active
- Support batch instance placement in put_2d_instances / put_3d_instances and flexible parameter aliases
- package.json: remove unused react-dnd-html5-backend and react-refresh, pin babel-plugin-macros to ^2.8.0
- CustomAIClient: exclude apiKey from localStorage persistence, normalize base URL without auto-appending /v1, bound local requests cache to 20 items, add cancel token support with axios, restrict markdown tool parsing to side-effect-free tools, return empty results for asset/resource searches
- UseGenerateEvents: use activeUserId in getAiGeneratedEvent polling
- EditorFunctions: validate batch entries before scene insertion in put2dInstances and put3dInstances, fix instance rotation with setAngle for 3D
- Preferences: fix temperature input to support 0 and clamp 0.0-1.0, exclude apiKey from localStorage
- Generation & Usage: route requests and events by local ID prefix, partition status requests, decouple BYOK checks from subscription status
- Tests: reset state in beforeEach, update tests for base URL normalization, side-effect-free tools, and empty search results
feat(ai): Bring Your Own Key (BYOK) custom OpenAI-compatible endpoint support
@BillyOutlast
BillyOutlast requested a review from 4ian as a code owner August 19, 2026 20:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BYOK (Bring Your Own Key/Model) support for GDevelop AI Agent Feature Request: BYOK (Bring Your Own Key/Model) support for GDevelop AI Agent

1 participant