Currently, this plugin is only suported on versions of Unity 2022.x and above
This plugin is provided as a custom Unity package that you can import into any existing project with the Unity version 2022.x and above.
Once you've downloaded the Unity package, you can drag the AlibabaManager.prefab
into your scene (inside the AlibabaCloud
folder).
Alibaba Cloud provides an alternative to ChatGPT for Unity developers. Here's a quick guide to setting up the Qwen Model through Alibaba Cloud:
- Setup Guide: Watch the YouTube tutorial
To get started you will first need to fetch your Application ID, which can be found in the Alibaba Cloud Platform under My Application
(or through this direct link). Here, you can create a new Application and copy the ID value (you will need this ID for the next step).
You can select any model for your application. Nevertheless, I recommend using an "OpenSource" Model if they are available (Time-limited Free Trial).
Currently, the Qwen2.5 Series is on Free Trial (Please, double check the model is on Free Trial before using it).
To continue you will need to fetch your API key, which can be found under API-KEY
(or through this direct link. Here, you can create a new API KEY (you will need this API KEY for the next step too).
Inside the package, you will find an AlibabaManager.prefab
that you can drag into your Scene. This prefab contains a AlibabaAPI.cs
script attach to it. Add your API Secret Key inside the API Key
field, and your application ID inside the App ID
. And, you can start using Alibaba Cloud.
This plugin provides one main function called SendPrompt(string promptText)
. This function contains an IEnumerator, IEnumerator SendPromptRequestToDashScope()
, which sends a prompt to the Alibaba Cloud API and prints the response to the console by calling Debug.Log().
There is another function called SendChat()
. This function contains an IEnumerator, IEnumerator SendChatRequestToDashScope(string message)
, which saves your session_id so you can keep a conversation with the Alibaba Cloud API. All the responses are printed in the console through a Debug.Log().
Unity connects with Alibaba API through https://dashscope-intl.aliyuncs.com/api/v1/apps/{0}/completion.
After hitting on play, your Scene grabs the prompt you set inside Your prompt
variable, and sends it to the Alibaba Cloud API.
There is an Example
folder that contains a Chat
scene. You can use this scene to interact directly with the API in a conversation.
Alibaba Cloud account offers a Pay-As-You-Go subscription to use the API. Nevertheless, it might be cheaper than ChatGPT API.
Alibaba Cloud might offer you a Free Trial for different models during the first 30 days.
Alibaba Cloud might offer you certain Open-source models.
Note that Alibaba Cloud is a paid API, I recommend using Gemini instead, which is free upon certain amount of requests. Read the pricing details before using any service.