How to Set or Clear the API Key

By Paul Flanders · · Beginner

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

  1. Open the Command Palette and run eLLM: Set API Key. You can also press / in the chat composer and choose Set API key.
  2. Paste the key into the input box and press Enter. The characters are masked.
  3. Send any message in the chat to confirm the key works.
  4. 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.apiKey setting in settings.json contains 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.

Related

Knowledge base 11 Sep 2026

How to Send Identity and Intent Headers to the Gateway

Learn how to configure identity and intent headers for a shared gateway using eLLM Code. This guide explains how to adjust settings in VS Code, ensuring requests are routed correctly and usage is attributed accurately.

Knowledge base 11 Sep 2026

How to Tune Generation Settings for Your Model

Learn how to fine-tune generation settings for local and self-hosted models to improve performance and accuracy. Adjust parameters like repetition, prompt size, and command timeouts to better match your model's behaviour.

Knowledge base 11 Sep 2026

How to Run the Benchmark Suite

This article provides a detailed guide on running a benchmark suite to test model configurations, including setup requirements, steps for execution, and troubleshooting tips. It's aimed at advanced users looking to evaluate model capabilities before deployment.

Expand 29 Jul 2026

How AI can support pupils with SEND

Explore how AI tools are aiding pupils with special educational needs and disabilities by simplifying text, breaking down tasks, and enhancing accessibility. Learn about the considerations schools should make before implementation.

Expand 29 Jul 2026

AI policy and practice in further education

Further education colleges need distinct AI policies due to their unique mix of vocational courses, diverse age groups, and specific funding and inspection requirements. This guidance highlights the importance of tailored AI approaches in FE settings.