Aider Configuration Guide for Restricted Networks and Approved Model Providers

    Learn how to install Aider with uv, connect it to an approved OpenAI-compatible model service, and verify network access, certificates, API keys, and model settings. This guide also covers troubleshooting, manual review of code changes, and team checklists for model selection, credential management, and data security.

    This guide is for teams running a command-line AI coding assistant on an internal network or behind restricted outbound access, and for developers or small teams authorized to use an approved model provider, including China-based providers where permitted.

    1. Scope and Boundaries

    This guide covers configuration, not methods for bypassing network controls. It assumes you are authorized to use your chosen model service and will follow your organization’s network and data security policies. Obtain accounts and API keys through your organization’s approval process; provider account registration is outside the scope of this article.

    If a connection fails, ask your network administrator to confirm outbound access policies. Do not independently change firewall or proxy rules.

    The setup has four separate layers, making individual components easier to upgrade or replace:

    Layer Purpose What can change
    Runtime Provides the Python environment Python version
    Command-line tool Reads project files, prepares prompts, and writes changes The CLI tool
    Connection configuration Defines the API endpoint, model name, timeout, and commit policy Environment variables or configuration files
    Model service Provides an OpenAI-compatible API Model provider

    This separation lets teams manage tool upgrades, model changes, and network policy adjustments independently. Teams can also maintain separate installation and model-connection guides for new users to follow in sequence.

    2. Install uv, Python, and Aider

    uv manages Python versions and packages. Installing Aider with uv places it in an isolated tool environment without affecting the system Python installation.

    On macOS, install uv with Homebrew:

    1. brew install uv

    On Linux, use the official installation script:

    1. curl -LsSf https://astral.sh/uv/install.sh | sh

    On Windows, run the following in PowerShell:

    1. powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"

    Verify the installation, then install Python 3.12:

    1. uv --version
    2. uv python install 3.12
    3. uv python list

    An installation path for Python 3.12 in the output confirms that the runtime is ready.

    Install Aider in an isolated tool environment:

    1. uv tool install aider-chat --python 3.12
    2. aider --version

    Record the version number. Options may change between releases; if the behavior differs from this guide, consult aider --help and the official documentation.

    If the aider command is not found, run uv tool update-shell and open a new terminal. This updates PATH and is useful when the current terminal has not picked up a new installation. On macOS and Linux, verify the command path with command -v aider. In PowerShell, use Get-Command aider.

    Do not configure an API key yet. First, check that help output works in an empty directory. The following commands use macOS/Linux shell syntax:

    1. mkdir -p ~/aider-check && cd ~/aider-check
    2. aider --help | head -n 20

    3. Check Network Connectivity and Certificates

    Check API Reachability

    Replace <model-gateway-host> with the hostname supplied by your provider. If your organization requires a proxy, first confirm that HTTPS_PROXY is configured; curl reads this variable automatically.

    1. curl -sS --connect-timeout 10 -o /dev/null -w "%{http_code}\n" https://<model-gateway-host>/v1/models

    This request does not include an API key. A 401 response is expected when the endpoint is reachable but requires authentication.

    Use the response to determine the next step:

    Result Meaning Next step
    401 The endpoint is reachable and requires authentication Continue with API key configuration
    200 The endpoint is reachable and the request was accepted Continue
    403 A gateway or access policy rejected the request Check outbound allowlists and account permissions
    404 The path is incorrect, or the service does not provide this endpoint Verify the base URL in the provider’s documentation
    5xx Server-side error Retry later or contact the provider
    000 or timeout The connection was not completed Follow the troubleshooting sequence below

    For 000 responses or timeouts, check the following in order. Resolve any issue before moving to the next step:

    1. Confirm that the HTTPS_PROXY address and port match your organization’s instructions.
    2. Check DNS resolution, for example with nslookup <model-gateway-host>.
    3. Confirm that the corporate root certificate is configured, as described below.
    4. If these checks pass but the connection still fails, ask your network administrator to verify outbound access policies.

    Keep only status codes when sharing diagnostic results. Never paste authorization headers or API keys into tickets, chats, or logs.

    Resolve Certificate Errors

    Corporate TLS inspection systems can cause CERTIFICATE_VERIFY_FAILED errors. The correct approach is to add the corporate root certificate to the system trust store or configure the tool to use the certificate file.

    For example:

    1. export SSL_CERT_FILE="/path/to/corp-root-ca.pem"

    The appropriate variable depends on the library in use. Another common variable is REQUESTS_CA_BUNDLE; consult the relevant library documentation.

    You can test the certificate explicitly with curl:

    1. curl --cacert /path/to/corp-root-ca.pem -sS -o /dev/null -w "%{http_code}\n" https://<model-gateway-host>/v1/models

    A 401 or 200 response indicates that certificate verification succeeded.

    Do not disable certificate verification. Doing so can expose API keys and source code to interception in transit—a greater risk than a failed connection.

    4. Configure the API Endpoint, Key, and Model

    Aider can call models through an OpenAI-compatible API. The following configuration applies when your provider offers a compatible endpoint.

    Three settings are required: the API base URL, API key, and model name. Optional settings control request timeouts and automatic commits.

    Set the API Base URL

    1. export OPENAI_API_BASE="https://<model-gateway-host>/v1"

    For the endpoint layout used in this guide, include /v1 in the base URL. Omitting it commonly results in a 404. Confirm the exact base URL against your provider’s documentation.

    Set the API Key

    Store API keys only in environment variables or an approved secrets manager. Never put them in source repositories, Git commits, logs, support tickets, or chat messages.

    On macOS and Linux, retrieve the key from your organization’s secrets manager or system keychain and set it for the current terminal session:

    1. export OPENAI_API_KEY="<key-retrieved-from-secrets-manager>"

    In PowerShell:

    1. $env:OPENAI_API_KEY = "<key-retrieved-from-secrets-manager>"

    Do not pass the key with --openai-api-key. Command-line arguments can remain in shell history and may be visible to other users through process listings.

    If you use a .env file to store variables, add it to .gitignore and confirm that it has never been committed.

    Set the Model Name

    Use openai/ followed by the model name supplied by the provider. The openai/ prefix selects the OpenAI-compatible calling convention; OPENAI_API_BASE determines the destination.

    Use the model identifier returned by the provider’s /models endpoint.

    1. aider --model openai/<model-name>

    Alternatively, set an environment variable, which can be useful in a team startup script:

    1. export AIDER_MODEL="openai/<model-name>"

    Configuration Reference

    Setting Example Notes
    OPENAI_API_BASE https://<model-gateway-host>/v1 Include /v1 for the endpoint layout shown here
    OPENAI_API_KEY Retrieved from a secrets manager Supply securely through the environment
    Model name openai/<model-name> Use the provider’s exact model identifier
    Timeout --timeout 60 Measured in seconds; increase if appropriate for a slow connection
    Commit policy --no-auto-commits Review changes manually before committing

    If your organization requires anonymous usage analytics to be disabled, add --no-analytics.

    5. Verify the First API Call

    First, use curl to check whether the API key works. This command prints only the HTTP status code, not the key:

    1. curl -sS --connect-timeout 10 -o /dev/null -w "%{http_code}\n" \
    2. -H "Authorization: Bearer $OPENAI_API_KEY" \
    3. "$OPENAI_API_BASE/models"

    A 200 response confirms that this request reached the endpoint and was accepted with the supplied credentials. For other responses, see Section 6.

    Next, run an actual model request in the test directory. Create a sample file and initialize a Git repository so you can inspect Aider’s changes:

    1. cd ~/aider-check
    2. printf 'def add(a, b):\n return a + b\n' > calc.py
    3. git init -q
    4. aider --model openai/<model-name> --no-auto-commits --message "Add a one-line docstring to the add function in calc.py" calc.py

    Review the changes Aider produces and any prompts it presents, then inspect the result with git diff. Disabling automatic commits does not replace manual review of file edits.

    Delete the sample directory when testing is complete.

    6. Troubleshoot Common Errors

    Symptom Possible cause Action
    401 Unauthorized Missing, mistyped, or revoked key; extra whitespace or quote characters; a provider-side quota restriction Run echo ${#OPENAI_API_KEY} in the current shell to check the key’s length without printing it. Set the key again and, if necessary, confirm quota status with the provider
    404 Not Found Incorrect base URL, missing /v1, or an incorrect model name Check OPENAI_API_BASE against the provider’s documentation and verify the model identifier through /models
    403 Forbidden Outbound access policy or missing permission to use the model Contact your network administrator and the provider’s account administrator
    Timeout or 000 Proxy, DNS, firewall, or certificate issue Follow the checks in Section 3; increase --timeout only after connectivity is working
    CERTIFICATE_VERIFY_FAILED The corporate inspection certificate is not trusted Configure the appropriate certificate setting, such as SSL_CERT_FILE, as described in Section 3. Do not disable verification
    5xx Server-side error Retry later; contact the provider if the problem persists

    When troubleshooting, share only status codes and error categories. If a key appears in a log, screenshot, or support ticket, revoke it immediately through the provider’s management interface and issue a replacement.

    7. Team Readiness Checklists

    Model Selection

    Check What to verify Acceptance criteria
    API compatibility OpenAI-compatible API and a /models endpoint The authenticated curl request in Section 5 returns 200
    Coding capability Test edits using representative team code Changes pass tests and produce readable diffs
    Context length Confirm the maximum supported input length It accommodates the team’s typical single-task scope
    Response time Measure typical request latency during working hours Requests do not frequently time out
    Pricing and quotas Check billing units and daily or monthly limits Costs and limits fit the team’s budget
    Migration effort Verify the process for changing the endpoint and model name Provider-switching steps are documented

    API Key Governance

    Check What to verify Acceptance criteria
    Issuance Issue keys per person or project rather than sharing one across the team Every key has an accountable owner
    Permissions Enable only the required models and endpoints Permissions are documented and reviewed regularly
    Usage limits Configure spending or usage limits and alerts Notifications arrive promptly when limits are reached
    Storage Use environment variables or an approved secrets manager No keys are found in repositories, logs, or tickets
    Rotation and revocation Rotate according to team policy and revoke immediately after exposure Actions are recorded, and revocation can be completed quickly

    Data Handling

    Check What to verify Acceptance criteria
    Provider data policy Review input/output retention, training use, and storage location Terms match organizational data-classification rules and have been approved
    File scope Understand that file contents added to an Aider session are sent to the model service Include only files needed for the task
    Sensitive-file exclusions Do not add .env files, certificates, private keys, customer data, or internal credentials Sensitive files are covered by the applicable exclusion rules
    Redaction Replace account details, addresses, and business data in code with sample values A person has reviewed the content before transmission
    Session records Define where session records are stored and when they are deleted Storage and retention follow the team’s logging policy

    Complete these checks before rolling out Aider to a team. Revisit them whenever the model provider or API keys change.