Build a Personal AI Assistant Locally at Zero Cost: A Practical Guide

    This guide explains when running a personal AI assistant locally becomes a practical, near-zero-cost option compared with cloud subscriptions, and how to choose a setup based on billing transparency, data boundaries, maintainability, and migration cost. It walks through preparing a clean local environment, diagnosing the common PowerShell "running scripts is disabled on this system" error with execution policy settings, and hardening security and cost with least-privilege operation, access control, credential management, resource limits, and backups. Readers will learn a step-by-step path from environment preparation to reviewing scripts, applying minimal permissions, and adding observability, so most installation failures and security risks can be prevented in advance.

    1. Why Self-Hosting Locally Is Viable Again

    Over the past couple of years, personal AI assistants have generally fallen into two categories. One is cloud subscription services: pay monthly, ready to use out of the box. The other is self-hosting locally, where inference and orchestration run on hardware you control. The first wins on convenience; the second wins on control and low marginal cost.

    The core motivation discussed here is simple: price. Cloud offerings on the market range from a few tens of yuan to around two hundred yuan per month, with differences driven mainly by model size, context length, concurrency limits, and whether a toolchain is bundled. The biggest advantage of self-hosting is that once the device and runtime environment are ready, the marginal cost of continued use is close to zero. That is also why many people dust off old laptops and old mini PCs. The hardware itself is a sunk cost and requires no additional purchase.

    To be clear, “zero cost” only holds under specific conditions: you already own the device, electricity and network costs are negligible, the model size is limited, and concurrency demand is low. Once you require longer context, higher concurrency, or stronger reasoning, spending on local hardware rises quickly. So the first step in choosing a setup is not finding a tool but defining your own constraints.

    2. Four Dimensions for Evaluating Options

    To judge whether an option fits you, evaluate the following dimensions rather than looking only at the first-month price:

    • Billing transparency: Whether charges stack up across pay-as-you-go, tiered pricing, resource packages, and idle-time billing. The more billing items there are, the harder actual spending is to predict.
    • Data boundaries: Whether data leaves the machine, whether it is used for training, and how long logs are retained. When personal files and code repositories are involved, this should take priority over price.
    • Maintainability: Whether upgrades, rollbacks, and backups are simple, and whether you can diagnose problems yourself.
    • Migration cost: Whether configuration and data can be exported, avoiding lock-in to a single option.

    A common mistake is being drawn in by an extremely low first-month price. Low prices often correspond to trial quotas, limited-time promotions, or basic resource tiers, and billing becomes significantly more complex once you move into real usage. The rational approach is to run a small-scale validation first, use real tasks for a week, and then decide whether to commit long term.

    3. Preparing the Local Environment

    The success of a local deployment depends 80% on whether environment preparation is clean. Proceed in this order:

    1. Confirm the device and OS version, and record the operating system version and architecture (x64 / arm64).
    2. Install the runtime environment, typically a JavaScript runtime such as Node.js; after installation, verify the version meets requirements.
    3. Confirm the package manager is usable, and verify its configuration file and execution permissions are correct.
    4. Plan the storage directory, avoiding paths with spaces or non-English characters to reduce encoding and escaping issues.
    5. Prepare a rollback method, such as a system restore point or a virtual machine snapshot.

    Illustrative verification commands (demonstrating the idea only, not any specific product):

    1. node -v
    2. npm -v
    3. npm config get prefix

    4. Root-Cause Analysis of Installation Script Failures

    The error encountered here, which reports that running scripts is disabled on this system, is an extremely typical problem. It has nothing to do with whether the account is an administrator; the root cause is the operating system’s script execution policy.

    In Windows PowerShell, the execution policy determines which script files can be loaded and run. The default policy is often restricted, so even with sufficient privileges, .ps1 scripts are still refused. Common checks and fixes are as follows:

    1. # View the effective execution policy
    2. Get-ExecutionPolicy -List
    3. # Open up only for the current user, with the smallest scope of impact
    4. Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy RemoteSigned

    RemoteSigned means locally written scripts can run directly, while scripts downloaded from the network must carry a trusted signature. Compared with opening everything up, it strikes a better balance between usability and security.

    If it still fails after adjusting the policy, continue troubleshooting in this order:

    • Network and certificate issues: When a remote script download fails, check proxy settings and whether the system time is correct; clock drift causes certificate validation to fail.
    • Corrupted transfer content: Switch to a step-by-step approach: download the script locally first, verify its content, then run it, avoiding the lack of control that comes with “download and execute.”
    • Missing dependencies: When the runtime version is too old or the package manager is broken, reinstalling the runtime environment usually saves more time than continuing to patch it.
    • Path and encoding: Retry under a path with no spaces and English characters only.

    From a security standpoint, a “review first, then execute” workflow is preferable. Running a piped command directly from the network hands control of the machine to unreviewed code, which is usually not permitted in enterprise environments.

    5. Security and Cost Hardening Checklist

    Local deployment does not mean security by default; because it stays online long term and exposes ports, it is actually easier to overlook. At minimum, implement the following:

    • Least-privilege operation: Use a standard user account and elevate only when necessary.
    • Access control: Do not expose the management interface directly to the public internet; listen on the loopback address only, or access it through a reverse proxy with authentication.
    • Credential management: Put keys in environment variables or a dedicated credential management tool; do not write them into configuration files or code repositories.
    • Auditing and alerting: Connect logging services and monitoring alerts, and set threshold notifications for abnormal call volume and access during unusual hours.
    • Resource limits: Set CPU, memory, and concurrency caps for the local inference process to avoid dragging down the whole machine.
    • Regular updates and backups: Fix an upgrade cadence and keep configuration and data recoverable.

    If you later need to scale to multi-person collaboration or serve external users, then consider general cloud capabilities such as container platforms, object storage, and message queues to gain elasticity and observability. Until then, a single local machine is usually enough.

    6. Conclusion

    Back to the original question: different options involve trade-offs, and there is no universally optimal answer. The value of cloud subscriptions lies in predictability; the value of self-hosting lies in control and low marginal cost. What really matters is not finding “the cheapest one” but first thinking through your needs, data boundaries, and operations capability, then landing it in the order of environment preparation, script review, least privilege, and observability. Get execution policy, dependency integrity, and access control solid, and the vast majority of installation failures and security risks can be eliminated in advance.