Important
Support AI Service
- OpenAI
- Ollama
- Google Gemini
- Anthropic
- OpenRouter
- LM Studio
This software provides the ability to link OpenWrt and AI. Based on user input, the AI provides the optimal settings for OpenWrt; the OpenWrt device itself analyzes the information provided by the AI, verifies the validity of that information, and then notifies the user.
| Application | description |
|---|---|
| oasis | AI chat core software (provides stand-alone CUI-based chat functionality) |
| luci-app-oasis | This is a plugin to use AI chat from within LuCI's WebUI. (base software is oasis) |
| oasis-mod-tool | This is a plugin that enables AI to use tools. |
| Detail | description |
|---|---|
| OpenWrt Version Support | 24.x |
| Hardware Support | All |
| Install Size | 1.44MiB |
wget -O - https://raw.githubusercontent.com/utakamo/oasis/refs/heads/main/oasis_installer.sh | sh
Note
If an SSL certificate error occurs when running the above installer script, run the date command to check the current time. If the displayed time is incorrect, run /etc/init.d/sysntpd restart.
root@OpenWrt:~# date
root@OpenWrt:~# /etc/init.d/sysntpd restart
Important
This update script is available for Oasis version 3.0.0 and later. If you are using an older version, please uninstall it first and then reinstall using the installation script.
The upgrade script updates Oasis to the latest version while keeping your current settings intact.
wget -O - https://raw.githubusercontent.com/utakamo/oasis/refs/heads/main/oasis_upgrade.sh | sh
opkg remove oasis-mod-tool
opkg remove luci-app-oasis
opkg remove oasis
rm -r /etc/oasis
[Main] ---> [Network] ---> [Oasis] ---> [General Setting]
Note
If you want to use OpenAI, you need to set the Endpoint Type.
- Default Endpoint ----> https://api.openai.com/v1/chat/completions
- Custom Endpoint ----> User-specified endpoint
Please create an API Key on your OpenAI Platform page.
https://platform.openai.com/docs/overview
- gpt-3.5-turbo
- gpt-4
- gpt-4o
- etc...
Show more:
https://platform.openai.com/docs/models
Note
If you want to use OpenAI, you need to set the Endpoint Type.
- Default Endpoint ----> https://generativelanguage.googleapis.com
- Custom Endpoint ----> User-specified endpoint
Please create an API Key on your Google AI Studio.
https://aistudio.google.com/welcome
- gemini-2.0-flash
- gemini-2.5-flash
- etc ...
Note
If you want to use Anthropic, you need to set the Endpoint Type.
- Default Endpoint ----> https://api.anthropic.com/v1/messages
- Custom Endpoint ----> User-specified endpoint
Please create an API Key on your Anthropic Account page.
https://docs.claude.com/en/api/admin-api/apikeys/get-api-key
Please check Anthropic website.
https://docs.claude.com/en/docs/about-claude/models/overview
Note
If you want to use OpenRouter, you need to set the Endpoint Type.
- Default Endpoint ----> https://openrouter.ai/api/v1/chat/completions
- Custom Endpoint ----> User-specified endpoint
Please create an API Key on your OpenRouter Account page.
https://openrouter.ai/
Please check OpenRouter website.
https://openrouter.ai/models
Note
If you want to use Ollama, you need to set the Ollama parameters (OLLAMA_HOST and OLLAMA_ORIGINS) with the values shown below.
OLLAMA_HOST=0.0.0.0
OLLAMA_ORIGINS=*
Change the Ollama parameter configuration file (Linux) or environment variables (Windows) that exist on the PC where Ollama is installed to the above values.
My technical blog has an introductory page on the above Ollama setup, which describes the setup on Windows and Linux (Japanese Page). https://utakamo.com/article/ai/llm/ollama/setup/index.html#network-support
Ollama Endpoint Format: http://<Your Ollama PC Address>:11434/api/chat
In the example above, Ollama's IP address is 192.168.1.109/24, so http://192.168.1.109:11434/api/chat is set as the endpoint.
When using Ollama, an API key is typically not required, so nothing needs to be entered in the API Key field on this settings page.
Note
When using LM Studio, an API key is typically not required, so nothing needs to be entered in the API Key field on this settings page.
[Main] ---> [Network] ---> [Oasis] ---> [Chat with AI]
When chatting with AI for the first time, you can choose what topics to talk about. These options can be freely added or removed by the user in the System Message tab.
When a chat with AI begins, it is given a title and displayed in the chat list on the left side.
"Users can continue chatting with AI, and if there is chat data from the past, they can select it to resume the conversation.
Chat data can be renamed, exported, or deleted.
In Oasis, users can create and save system messages to use when starting a chat with AI. System messages are preloaded data used by AI to respond to the user.
For example, add a message like the following as a system message to instruct the AI to interpret English and Japanese.
Enter the instructions for the AI into the text area of 'Create System Message' and press the Add button to add it to the System Message List. This will register a new System Message called 'Translator.'
When you return to the Chat with AI tab and start a new chat with the AI, 'Translator' will appear as a topic option.
When 'Translator' is selected, the user's English message will be translated into Japanese by the AI.
In this way, by including instructions or specific knowledge for the AI as system messages, it is possible to modify the AI's behavior toward users.
Currently, Oasis adjusts responses related to OpenWrt solely through system messages.
As a result, by storing information about OpenWrt settings as knowledge in existing or new system messages, it will become specialized in modifying OpenWrt settings.
In particular, Oasis analyzes whether content related to modifying OpenWrt settings (UCI command sequences) found within AI responses can be executed. Then, it notifies the user with a popup.
By installing oasis-mod-tool, an extension module for Oasis, the AI will be able to use the tools. After installation, you can optionally enable AI tools from the Tools tab.
The following is an example with both get_lan_ipaddr and get_ifname_list enabled.
By enabling the tools, the AI will begin using them in response to user requests.
You can add Oasis tools as plugins, giving you the freedom to let the AI use whichever tools you prefer.
Building your own tools is easy, too.
For more information, check out the repository below.
https://github.com/utakamo/oasis-tool-box
Important
This feature requires that the AI supports tool usage. OpenAI's AI can use tools.
However, when using Ollama, some AIs may not support tool usage.
For details on which Ollama AIs support tools, please refer to the URL below.
https://ollama.com/blog/tool-support
In Oasis, users can freely change the AI's chat icon to create a sense of familiarity with the AI.
Click your preferred icon image and press the Select button to apply the setting.
To add your favorite icon image (e.g., png), drag and drop it or click under Upload Icon.
Pressing the Upload button stores the icon in the OpenWrt device.
root@OpenWrt:~# oasis
Usage: oasis <command> [[<options>] arguments]...
Options:
-u <Endpoint> Set the AI Service Endpoint(URL)
-k <api-key> Set the API key
-m <model> Set the LLM model
-p <storage> Set the storage path
-s <sysmsg key> Select the system message key (for sysmsg command)
-c <system message> Create new system message data (for sysmsg command)
Commands:
storage <path> [<chat-max>]
add [<service> [<endpoint> [<api-key> [<model> [<storage>]]]]]
change [no=<service-number> [<options> <value>]...]
select [no=<service-number>]
delete no=<service-number>
chat [no=<chat-number>]
prompt <message>
sysmsg [<chat|prompt> <options> <value>]
delchat no=<chat-number>
rename no=<chat-number> <title>
list
tools
Docs:
https://github.com/utakamo/oasis
- Example of OpenAI
root@OpenWrt:~# oasis add
Service ("Ollama" or "OpenAI") >> OpenAI
Endpoint(url) >> https://api.openai.com/v1/chat/completions
API KEY (leave blank if none) >> <your_api-key>
LLM MODEL >> gpt-4
- Example of local ai service (Ollama)
root@OpenWrt:~# oasis add
Service ("Ollama" or "OpenAI") >> Ollama
Endpoint(url) >> http://192.168.3.16:11434/api/chat
API KEY (leave blank if none) >>
LLM MODEL >> gemma2:2b
- The first service registered with the oasis add command is selected.γ
- To switch to another AI service, run oasis select . The following is an example of switching the service in use to Service No: 3.
root@OpenWrt:~# oasis chat
You :Hello!
gemma2:2b
Hello! π
How can I help you today? π
Title:ConversationStart ID:7772532380
You :/history
{"messages":[{"content":"Hello!","role":"user"},{"content":"Hello! π How can I help you today? π \n","role":"assistant"}],"model":"gemma2:2b"}
You :exit
| slash cmd | description |
|---|---|
| /exit | Terminate the chat with the AI. |
| /history | Display the chat history(JSON) |
Confirm Chat Data
root@OpenWrt:~# oasis list
-----------------------------------------------------
No. | title
-----------------------------------------------------
[ 1]: Hello
[ 2]: ConversationStart
Resume conversation with the AI by specifying the chat ID.
root@OpenWrt:~# oasis chat no=1
You :Hello!
gemma2:2b
Hello! π How can I help you today? π
You :
root@OpenWrt:~# oasis prompt "Hello!!"
Hello! π What can I do for you today? π
root@OpenWrt:~#
root@OpenWrt:~# oasis tools
- oasis.lua.tool.server
1: get_connected_clients - disable
2: get_cpu_temp - disable
3: get_ifname_list - enable
4: get_lan_ipaddr - disable
5: get_storage_usage - disable
6: get_system_load - disable
7: get_wan_status - disable
8: wifi_scan - disable
- oasis.ucode.tool.server1
9: get_board_info - disable
- oasis.ucode.tool.server2
10: get_os_info - enable
Would you like to enable or disable a tool? (E/D/N): E
Target Tool No: 7
Enabled tool: get_wan_status
The RPC functionality is used for integration with external devices. In OASIS, this feature is primarily supported with the expectation of integration with chat applications on smartphones and similar platforms.
oasis-mobile-client: https://github.com/utakamo/oasis-mobile-client
Dependency Package: uhttpd-mod-ubus
Note
If you wish to use this functionality, you may need to install uhttpd-mod-ubus.
root@OpenWrt~# opkg update
root@OpenWrt~# opkg install uhttpd-mod-ubus
Oasis supports RPC functionality.
If you want to use the RPC feature, please check the RPC radio button on the Oasis settings page.
The following is an example of message request and response exchange utilizing Oasis's RPC function. The assumed router credentials are as follows:
- Username:
root - Password:
12345678 - OpenWrt Device Ip address:
192.168.1.1/24
- [Request]
curl -H 'Content-Type: application/json' -d '{ "jsonrpc": "2.0", "id": 1, "method": "call", "params": [ "00000000000000000000000000000000", "session", "login", { "username": "root", "password": "12345678" } ] }' http://192.168.1.1/ubus - [Response (Example)]
{"jsonrpc":"2.0","id":1,"result":[0,{"ubus_rpc_session":"3cc578e5bc9f2b032c6445ea5696c9c8","timeout":300,"expires":299, ...
The ubus_rpc_session in this response will be used for sending subsequent requests. In this example, the ubus_rpc_session is 3cc578e5bc9f2b032c6445ea5696c9c8, so this number is used in the next request submission example.
- [Request]
curl -H 'Content-Type: application/json' -d '{ "jsonrpc": "2.0", "id": 1, "method": "call", "params": [ "3cc578e5bc9f2b032c6445ea5696c9c8", "oasis", "base_info", {} ] }' http://192.168.1.1/ubus - [Response (Example)]
{"jsonrpc":"2.0","id":1,"result":[0,{"sysmsg":[{"key":"default","title":"OpenWrt Teacher (for High-Performance LLM)"},{"key":"custom_1","title":"OpenWrt System Knowledge (Sample)"},{"key":"custom_2","title":"OpenWrt Network Knowledge (Sample)"}],"configs":["dhcp","dropbear","firewall","luci","network","system","ubihealthd","uhttpd","wireless"],"service":[{"identifier":"1270318202","name":"OpenAI","model":"gpt-4"},{"identifier":"5336525023","name":"Ollama","model":"gemma2:2b"}],"icon":{"list":{"icon_1":"openwrt.png","icon_2":"operator.png"},"ctrl":{"using":"icon_1","path":"/www/luci-static/resources/oasis/"}},"chat":{"item":[{"id":"1873851023","title":"UIThemeChange"},{"id":"3598688228","title":"OpenWrtUIThemeChanges"},{"id":"6053520290","title":"\"ConfiguringWi-FiSettingsinOpenWrt\""},{"id":"3850114087","title":"\"GuidetoBasicOpenWrtNetworkandWi-FiSettingsUsingUCICommands\""}]}}]}
By sending and receiving the above request and response, you obtain the basic information needed to start the chat. The basic information includes system messages (knowledge) and corresponding keys, which can be properly specified in the fields for chat message requests explained next, allowing you to send messages to the AI.
- [Request]
curl -H 'Content-Type: application/json' -d '{ "jsonrpc": "2.0", "id": 1, "method": "call", "params": [ "3cc578e5bc9f2b032c6445ea5696c9c8", "oasis.chat", "send", {"id": "", "sysmsg_key": "default", "message": "Hello!!"} ] }' http://192.168.1.1/ubus - [Response (Example)]
{"jsonrpc":"2.0","id":1,"result":[0,{"id":"6441905234","uci_parse_tbl":{"status":"No Parsing ..."},"content":"Hello! How can I assist you with OpenWrt today?","title":"\"OpenWrtAssistanceSessionIntroduction\""}]}
The AI's response in the initial conversation includes a chat ID (Ex: 6441905234). To continue the conversation, you need to include this chat ID when sending a message."
- [Request]
curl -H 'Content-Type: application/json' -d '{ "jsonrpc": "2.0", "id": 1, "method": "call", "params": [ "c5b484940761463117b0ab5d4a6105e7", "oasis.chat", "send", {"id": "6441905234", "sysmsg_key": "default", "message": "Please change the hostname to utakamo. "} ] }' http://192.168.1.1/ubus - [Response (Example)]
{"jsonrpc":"2.0","id":1,"result":[0,{"content":"Sure, you can change the hostname to 'utakamo' using the UCI command. Here are the steps you need to follow:\n\n1. Open a terminal.\n\n2. Enter the following command:\n\n```bash\nuci set system.@system[0].hostname='utakamo'\n```\n\nNow, your system's hostname should be updated to 'utakamo'. Please let me know if you have any other questions or tasks!","uci_parse_tbl":{"uci_notify":true,"uci_list":{"delete":[],"set":[{"class":{"option":"hostname","config":"system","value":"'utakamo'","section":"@system[0]"},"param":"system.@system[0].hostname='utakamo'"}],"del_list":[],"reorder":[],"add_list":[],"add":[]}}}]}
- [Request]
curl -H 'Content-Type: application/json' -d '{ "jsonrpc": "2.0", "id": 1, "method": "call", "params": [ "3cc578e5bc9f2b032c6445ea5696c9c8", "oasis.chat", "load", {"id": "0132179937"} ] }' http://192.168.1.1/ubus - [Response (Example)]
{"jsonrpc":"2.0","id":1,"result":[0,{"messages":[{"content":"You are an AI that listens to user requests and suggests changes to OpenWrt settings.\nWhen a user requests changes to network or Wi-Fi settings, please suggest the OpenWrt UCI commands that will achieve the user's expected settings.\nIf the user asks questions unrelated to OpenWrt settings, there is no need to answer about OpenWrt settings.\nRegarding network and Wi-Fi settings using OpenWrt UCI commands, I will teach you the following basic content.\n[1] Setup AP setting\nStep1: Activate Wi-Fi\n```\nuci set wireless.radio0.disabled=0\nuci set wireless.radio0.country=JP\nuci set wireless.radio0.txpower=10\nuci set wireless.default_radio0.ssid=OpenWrt\nuci set wireless.default_radio0.encryption=psk2\nuci set wireless.default_radio0.key=OpenWrt1234\n```\nThe value of wireless.default_radio0.key should be an appropriate string in the following format.\nFormat: alphanumeric characters + special characters, 8~63 characters\nStep2: Accept IP address assignment by DHCP server.\n```\nuci set network.lan.proto=dhcp\n```\n[2] Setup Basic Router setting\nStep1: Activate Wi-Fi\n```\nuci set wireless.radio0.disabled=0\nuci set wireless.radio0.country=JP\nuci set wireless.radio0.txpower=10\nuci set wireless.default_radio0.encryption=psk2\nuci set wireless.default_radio0.key=OpenWrt1234\n```\nStep2: Setup LAN segment network\n```\nuci set network.lan.device=wlan0\nuci set network.lan.ipaddr=192.168.4.1\n```\n'uci set network.lan.ipaddr=192.168.4.1' is the LAN-side IP address of the router.\nIn this example, it's set to 192.168.4.1, but if the user specifies a different IP address,\nplease follow their instructions.\nStep3: Setup WAN segment network\n```\nuci set network.wan=interface\nuci set network.wan.device=eth0\nuci set network.wan.proto=dhcp\n```\nIn the initial settings, there is no 'wan' section in the network configuration,\nso you need to create a new 'wan' section by executing 'uci set network.wan=interface'.\n","role":"system"},{"content":"Hello","role":"user"},{"content":"Hello! π What can I help you with today? π \n\nDo you have any questions about OpenWrt settings or would you like me to suggest changes for your network configuration? \n","role":"assistant"}]}]}
When sending a request, set the id field (Ex:0132179937). The value of this id should be specified as the id included in the response of the base information retrieval or the initial conversation. The chat data corresponding to that id will be returned as the response.
root@OpenWrt:~# ubus -v list oasis
'oasis' @689f0349
"load_icon_info":{}
"select_icon":{"using":"String"}
"load_sysmsg_list":{}
"load_sysmsg_data":{}
"delete_icon":{"target":"String"}
"add_sysmsg_data":{"title":"String","message":"String"}
"config":{}
"base_info":{}
"analize":{"message":"String"}
"update_sysmsg_data":{"target":"String","title":"String","message":"String"}
"delete_sysmsg_data":{"target":"String"}
"confirm":{}
"select_ai_service":{"id":"String","name":"String","model":"String"}
root@OpenWrt:~# ubus -v list oasis.chat
'oasis.chat' @b4e0a13c
"delete":{"id":"String"}
"list":{}
"append":{"content2":"String","id":"String","role2":"String","role1":"String","content1":"String"}
"create":{"content3":"String","content2":"String","content1":"String","role2":"String","role1":"String","role3":"String"}
"load":{"id":"String"}
"send":{"id":"String","sysmsg_key":"String","message":"String"}
root@OpenWrt:~# ubus -v list oasis.title
'oasis.title' @bb1a58e9
"auto_set":{"id":"String"}
"manual_set":{"id":"String","title":"String"}
- libnghttp2-14.
- libcurl4.
- liblua5.1.5.
- lua.
- lua-curl-v3.
- libubus-lua.
- luci-lib-nixio.
- luci-lib-ip.
- luci-lib-jsonc.
- liblucihttp-lua.
- luci-lib-base.
- ucode-mod-lua.
- luci-lua-runtime.
- luci-compat
- oasis
- oasis
This project is licensed under the MIT License.
This project includes the Material Icons font by Google, licensed under the Apache License, Version 2.0.