How to Set or Clear the API Key
Learn how to securely set or clear an API key in VS Code for eLLM gateways. This guide is essential for first-time key setup, key rotation, or when transferring a machine.
Estimated time: 1 minute
Difficulty: Beginner
Why you'd use this
Most eLLM gateways require a per-user or per-team API key. eLLM Code keeps that key in VS Code's secret storage, which is encrypted by the operating system, rather than in a plaintext settings file that could be committed or synced. You need this guide when you first receive a key, when a key is rotated, or when you hand a machine to someone else and want the key removed.
Before you start
Permissions required:
- A valid API key issued for the eLLM endpoint.
You'll need:
- The key itself, copied to the clipboard.
Steps
- Open the Command Palette and run eLLM: Set API Key. You can also press / in the chat composer and choose Set API key.
- Paste the key into the input box and press Enter. The characters are masked.
- Send any message in the chat to confirm the key works.
- To remove the key later, run eLLM: Clear API Key.
What you should see
A confirmation message appears after saving. In the ⚙ settings panel the API key field stays blank with the hint "Stored securely, leave blank to keep current", which shows the key is held in secret storage rather than in settings.
Troubleshooting
- Requests still fail after setting the key: check whether the
ellmCode.apiKeysetting insettings.jsoncontains an old value. That setting is only a fallback, but an outdated value there can be confusing. Prefer leaving it empty. - Working over Remote-SSH or in a container: secret storage belongs to the VS Code window, so set the key once per remote you connect to.
Related guides
- How to Install eLLM Code and Connect It to Your Endpoint
- How to Send Identity and Intent Headers to the Gateway
person people found this useful.