Skip to main content

Hapi Remote Control

#Hapi Remote Control

Hapi can put Claude Code, Codex, Gemini CLI and other command line tools into the browser for remote use. When connecting to MuskAI, the core is to configure the model service in Hapi with the API Key and Base URL provided by this site.

Preparation​

  • A working MuskAI account.
  • Create and copy the API Key on the official website User Center - [API Key] page.
  • Copy the currently recommended Base URL on the official website User Center - [API Key] page.
  • Node.js 18 and above has been installed on this machine or server.

Install Hapi​

Execute on the machine where Hapi needs to be run:

npx hapi

When starting for the first time, you will be prompted to install dependencies and create configurations. It is recommended to operate in a stable network environment. After the installation is completed, record the access address and management entrance output by the terminal.

Configure MuskAI service​

After entering the Hapi management interface, add or edit model services and fill in the following OpenAI compatible services:

FieldFilling method
Provider/ServiceCustom OpenAI compatible service
API KeyKey copied from the official website User Center - [API Key] page
Base URLBase URL copied from the official website User Center - [API Key] page
ModelModel name available in the console

After saving, create a new session and send simple questions to test connectivity. After the test is successful, you can configure the default model of Claude Code, Codex or other tools as needed.

Remote access​

If Hapi runs on the server, it is recommended to use a reverse proxy with HTTPS or Cloudflare Tunnel to expose the access entrance. Do not directly expose unprotected local ports to the public network.

Common practices:

  1. Hapi listens on the intranet port on the server itself.
  2. Use Nginx or Cloudflare Tunnel to forward to the port.
  3. Set HTTPS, access password or source restrictions for the portal.
  4. Access the page on your phone or another computer, confirm that you can open the session and send the request.

verify​

Check three things after configuration is complete:

  • Hapi page can be opened normally.
  • You can receive model replies during the session.
  • MuskAI console can see the usage records of the corresponding API Key.

FAQ​

  • Connection failure: Check whether the Base URL is copied completely, and do not splice the interface address at the end of the path.
  • 401 or 403: Check API Key, balance, package permissions and model permissions.
  • Model does not exist: use console available model name instead.
  • The remote page cannot be opened: Check the server firewall, reverse proxy, tunnel status and port listening.