Deploying an AI Coding Assistant on Linux with a Custom LLM Provider: A Complete Guide
Learn how to install a CLI-based AI coding assistant on Ubuntu 24.04 LTS, connect it to a custom LLM provider via an interactive configuration wizard, verify the setup, and troubleshoot common issues such as authentication failures and model errors.
1. Background and Objectives
As large language models continue to evolve rapidly, more developers want AI-assisted programming capabilities directly in the command line—code generation, troubleshooting, script writing, and more. The open-source community has produced a number of CLI-based AI coding assistant tools that typically run as command-line interfaces, support multiple LLM service providers, and let users pick models flexibly with their own API keys.
This guide covers three goals:
- Install such a tool on the latest Linux LTS release (using Ubuntu 24.04 LTS as an example);
- Connect it to a custom LLM service through the interactive configuration wizard;
- Verify that the configuration works and learn how to troubleshoot common problems.
Note that the LLM service in this article is referred to generically as “a cloud LLM open platform.” For specific service names, billing rules, and API details, always refer to the official documentation of the platform you actually choose.
2. Environment Preparation
2.1 System Requirements
- A machine with public internet access running Ubuntu 24.04 LTS (other recent Debian-based distributions also work);
- A user account with sudo privileges;
- A Node.js runtime (most CLI tools of this kind are published via Node.js), version 18 or higher recommended;
- An account on an LLM open platform and the corresponding API key.
2.2 Installing Node.js
The Node.js version in Ubuntu 24.04’s default repositories may be outdated. Installing a newer version via NodeSource or a version manager is recommended. Using NodeSource as an example:
# Install dependenciessudo apt updatesudo apt install -y curl ca-certificates# Download and run the NodeSource setup script (20.x as an example)curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -sudo apt install -y nodejs# Verify the installationnode -vnpm -v
You can also use nvm for multi-version management, which suits developers who need to switch Node versions across projects:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bashsource ~/.bashrcnvm install 20
2.3 Preparing the API Key
Log in to the console of your chosen LLM open platform and create a new key on the “API Key Management” page. The key usually starts with a specific prefix—save it immediately after creation, as most platforms only display the full key once. For security:
- Never hardcode the key into a code repository or commit it to version control;
- Store it in an environment variable or use a secrets management tool;
- Follow the principle of least privilege: create separate keys for different purposes to simplify usage tracking and revocation.
3. Installing the CLI Coding Assistant
Open-source tools of this kind are typically installed globally via npm. The command pattern is as follows (openclaw is used here as a placeholder tool name—refer to the documentation of the tool you actually use):
npm install -g openclaw# Verify the installationopenclaw --version
If you run into permission issues with the global install, try one of the following:
- Change npm’s global install path to your user directory:
mkdir -p ~/.npm-globalnpm config set prefix '~/.npm-global'export PATH=~/.npm-global/bin:$PATH # Add to ~/.bashrc for persistence
- Or run it directly with npx to avoid a global install:
npx openclaw --version
4. Configuring a Custom LLM Provider
4.1 Launching the Interactive Configuration Wizard
Most of these tools provide a friendly interactive wizard, so there’s no need to edit configuration files manually. Run:
openclaw config
4.2 Step-by-Step Configuration
Once inside the wizard, complete the following steps as prompted:
Choose to add a custom provider: Select an option like “Add custom provider” from the list. A custom provider is chosen over a built-in one because the goal is to connect to a third-party endpoint compatible with the OpenAI-style API.
Enter a provider name: Pick a recognizable name, such as
zhipu(matching the platform you’re actually connecting to). This name is only used as an identifier in the local configuration file.Enter the API address (Base URL): Fill in the API endpoint of the target platform. For one LLM open platform, the general chat API base address typically looks like:
https://open.bigmodel.cn/api/paas/v4
Note that this is the base address, not the full chat/completions path—the tool usually appends the remaining path automatically. If requests return 404 after configuration, check whether a path segment was added or omitted by mistake.
Enter the API key: Paste the key you created in Section 2. The terminal may not echo what you type; this is normal security behavior—just paste and press Enter.
Select a default model: The wizard will usually ask you to enter or select a model name. Look up the currently available model IDs in the platform’s documentation. For example, a lightweight Flash-class model is well suited for everyday Q&A and simple coding tasks, offering faster responses and lower cost, while complex reasoning tasks can be switched to a more powerful flagship model.
4.3 Configuration File Location
After configuration, you can inspect the generated configuration file in your home directory (common paths include ~/.openclaw/ or ~/.config/openclaw/) to confirm the provider and model fields are correct. Before making manual adjustments, back up the file:
cp config.json config.json.bak
5. Verification and Usage
Once configured, run the tool and test a simple task:
openclaw chat "Write a Python script that reads a CSV file and computes column averages"
If it returns results normally, the configuration chain is working. Additional recommended checks:
- Streaming output test: Confirm that streaming rendering works properly for long responses;
- Long-context test: Paste a long piece of code to verify the context window behaves as expected;
- Proxy test: If you’re behind a proxy, confirm the tool process correctly inherits the proxy environment variables.
6. Troubleshooting Common Issues
- Authentication failure (401/403): Check whether the key was copied in full, has expired, or has been disabled, and confirm that the Base URL and key belong to the same platform.
- Model not found (404): The model ID may be misspelled, or your account may not have access to that model—use the identifiers listed in the platform’s documentation.
- Request timeouts: Check network connectivity and proxy settings; configure
HTTP_PROXY/HTTPS_PROXYfor the terminal if necessary. - Configuration not taking effect: Make sure you’re editing the configuration file under the current user. Some tools distinguish between global and project-level configurations, so pay attention to priority.
7. Security and Best Practices
- Rotate API keys regularly and assign separate keys to different devices;
- Monitor platform usage and set up spending alerts to avoid cost risks from abnormal calls;
- When sensitive code is involved, evaluate the compliance requirements of sending code snippets to a cloud service, and enable redaction or on-premises solutions where necessary;
- Keep the tool and Node.js versions up to date to receive security fixes promptly.
8. Conclusion
This guide walked through the complete process of installing a CLI AI coding assistant on Ubuntu 24.04 and connecting it to a custom LLM service via the interactive wizard. The key points are: correctly installed dependencies (Node.js), an accurate Base URL and API key, and model identifiers that match the platform’s documentation. With this approach, you can plug any OpenAI-compatible LLM service into your programming workflow, switching models flexibly per task to balance efficiency and cost.
