Configuring AI Coding Assistants for Third-Party LLM APIs
Learn why third-party LLM API configurations can work in a command-line tool but leave an editor extension stuck on its login screen. This guide explains the two configuration checks, recommends a layered setup, and outlines three verification steps for credentials, gateway connectivity, and extension behavior.
1. Why the Same Configuration Guide Can Produce Different Results
When connecting an AI coding assistant to a third-party model API, often through a compatible gateway, configuration guides tend to recommend one of two approaches.
The first is to put the service URL and access token in a global configuration file under the user’s home directory, such as ~/<assistant-directory>/settings.json, so the command-line tool and editor extension can share the configuration.
The second is to put those values directly in the editor’s extension environment-variable settings. Otherwise, the extension may remain on its login screen.
Users report both success and failure with each approach. The distinction is that these configuration locations serve two separate checks. A guide that addresses only one check may work for some launch environments but not others.
Understanding what each component reads—and when—makes it easier to build a reproducible setup and diagnose failures.
2. The Core Mechanism: Two Checks Before a Successful Request
The key distinction is between the extension’s own login check and the assistant runtime that actually sends model requests.
Check 1: The Extension’s Login Check
Before launching the assistant runtime, the extension checks whether credentials are available.
In the configuration model described here, this check reads the extension’s environment-variable settings in the editor’s user configuration. If the editor is launched from a terminal, the extension can also inherit environment variables exported in that shell session.
If credentials are unavailable at this stage, the extension panel remains on the login screen.
Check 2: The Runtime That Sends Requests
Once launched, the assistant runtime can inherit those environment variables and read the env block in ~/<assistant-directory>/settings.json.
If the necessary configuration is missing at this stage, requests may go to the default official endpoint or fail with an HTTP 401 authentication error.
| Stage | Configuration sources | What happens if configuration is missing |
|---|---|---|
| Extension login check | Extension environment variables in editor user settings; inherited shell variables when launched from a terminal | The panel remains on the login screen |
| Assistant runtime | Inherited variables plus the global configuration file’s env block |
Requests go to the default endpoint or return HTTP 401 |
This explains why apparently conflicting guides can both work.
A user who configures only the global file may also launch the editor from a terminal where the required variables are already exported. Those shell variables satisfy the first check, making it appear that the global file alone is sufficient.
A user who launches the editor from a desktop icon or system menu does not inherit variables exported in that terminal session. Exported variables apply to the current shell and its child processes, not to unrelated applications. That user may remain on the login screen until the credentials are added to the extension settings.
The Extension May Use Its Own Bundled Runtime
Another important detail is versioning. Editor extensions commonly bundle their own assistant runtime, with the extension version corresponding to that bundled runtime.
Updating the command-line tool does not automatically update the runtime used by the extension. When investigating version-specific behavior, check the version the extension actually runs rather than relying on the CLI version.
3. Recommended Approach: Layered Configuration
The guiding principle is:
Put credentials where the login check can read them, and put shared configuration where both the CLI and extension runtime can read it.
The paths and setting names below are illustrative placeholders. Replace them with the exact names documented for your assistant and its current version.
Layer 1: Editor User Settings
Open the command palette and select Open User Settings (JSON). Add a structure like this:
{"<assistant-extension>.environmentVariables": [{"name": "<service-url-variable>","value": "https://<your-gateway-address>"},{"name": "<auth-token-variable>","value": "<your-token>"}],"<assistant-extension>.disableLoginPrompt": true}
Use the authentication variable appropriate for your gateway:
- For a gateway that authenticates through an
Authorization: Bearerheader, use the token-type variable. - For a gateway that requires an API key header such as
x-api-key, use the API-key-type variable instead.
Confirm the exact environment-variable names in the relevant official documentation.
Layer 2: Global Configuration File
Use the env block in ~/<assistant-directory>/settings.json for settings shared by the CLI and extension runtime.
You can also include the same service URL and token there as a fallback, allowing the command-line tool to work independently of the editor.
Shared behavior settings, such as timeouts and retry policies, belong here as well. This separates the credentials needed by the extension’s login check from the common runtime behavior used by both interfaces. If credentials are duplicated for CLI fallback, keep those copies consistent.
Layer 3: Shell Configuration, If Needed
Users who work primarily from a terminal can also export the variables in their shell’s rc file.
However, this should not be the only configuration source if the editor is sometimes launched from a desktop shortcut or system menu. Those launch paths do not inherit variables exported by an unrelated shell session.
4. Verify the Setup in Three Steps
After configuring the assistant, verify each layer separately. This helps distinguish environment propagation problems from gateway failures and extension login issues.
Step 1: Check Environment-Variable Propagation
Open an integrated terminal in the editor and inspect the relevant variables:
env | grep <relevant-variable-name>
Alternatively, use an equivalent command to print the values.
This checks which variables are visible to that terminal. Keep in mind that extension-specific environment settings may apply only to the assistant process, so terminal output alone may not confirm whether those settings reached the extension runtime.
Step 2: Check Gateway Connectivity
Use a general-purpose HTTP client such as curl to send a minimal conversation request directly to the gateway.
Inspect the HTTP status code to identify gateway-side authentication failures, rate limits, or network problems. Use the request format and authentication method specified in the relevant API documentation.
Step 3: Check the Extension’s Login and Request Behavior
Completely exit and restart the editor rather than only reloading its window.
Open the extension panel and confirm that it no longer remains on the login screen. Then send an actual conversation request and verify that it reaches the configured gateway rather than the default endpoint.
Passing the login check is only part of the test: the runtime must also use the intended service URL and credentials.
5. Version Changes and Operational Precautions
Gateway integration behavior can change between versions. Relevant changes may include environment-variable precedence or stricter—or more permissive—login checks.
After an upgrade, repeat the three verification steps instead of assuming that a previously working configuration will continue to behave the same way.
Two additional practices are important:
- Do not commit tokens to a repository. Editor user settings and global configuration files are local to the machine and can be suitable for individual use, but they still contain sensitive credentials. For team environments, consider an appropriate secrets-management service.
- Check the current documentation before applying settings. The mechanism described here is based on official configuration documentation, but exact variable names, file paths, and behavior depend on the tool and version. Confirm them in your own environment before running commands.
Summary
An extension stuck on its login screen may be reading credentials from a different source than the runtime that sends model requests.
Put credentials and the service URL in the editor extension settings so the login check can read them. Use the global configuration file for shared runtime settings and, where needed, CLI credential fallback. Treat shell exports as an optional convenience rather than the sole source.
Finally, verify environment propagation, gateway connectivity, and the extension’s actual request behavior. This layered approach addresses both checks and supports consistent third-party LLM API access across different editor launch methods.
