# IAiKeyStore interface

Namespace: [Grasshopper2.Components.Descriptive](https://developer.rhino3d.com/api/gh2/namespace/grasshopper2.components.descriptive.md) · Assembly: [Grasshopper2](https://developer.rhino3d.com/api/gh2/assembly/grasshopper2.md)

```cs
public interface IAiKeyStore
```

Persistent storage for LLM-provider API keys. Implementations use the platform's native secret store: macOS Keychain on macOS, DPAPI-encrypted file on Windows. Keys are scoped to the current OS user account and to a specific [AiProvider](https://developer.rhino3d.com/api/gh2/type/grasshopper2.components.descriptive.aiprovider.md), so an Anthropic key and a Google key can coexist.

**Derived types:** [MacKeychainKeyStore](https://developer.rhino3d.com/api/gh2/type/grasshopper2.components.descriptive.mackeychainkeystore.md), [WindowsDpapiKeyStore](https://developer.rhino3d.com/api/gh2/type/grasshopper2.components.descriptive.windowsdpapikeystore.md)

## Methods

- [DeleteKey](https://developer.rhino3d.com/api/gh2/type/grasshopper2.components.descriptive.iaikeystore/deletekey.md): Removes the stored key for the given provider. Silent if no key was stored.
- [SetKey](https://developer.rhino3d.com/api/gh2/type/grasshopper2.components.descriptive.iaikeystore/setkey.md): Stores the given API key for the given provider, overwriting any existing entry. Throws on failure.
- [TryGetKey](https://developer.rhino3d.com/api/gh2/type/grasshopper2.components.descriptive.iaikeystore/trygetkey.md): Returns the stored API key for the given provider, or null if none is stored or it cannot be read.
