# AiComponent class

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
[IoId("00000000-a054-4c2b-9723-56cfe1c5860f")]
public sealed class AiComponent : Component
```

## Constructors

- [AiComponent](https://developer.rhino3d.com/api/gh2/type/grasshopper2.components.descriptive.aicomponent/ctor.md): (2 overloads)

## Properties

- [Backend](https://developer.rhino3d.com/api/gh2/type/grasshopper2.components.descriptive.aicomponent/backend.md): The LLM backend used for generation. Built lazily on first read from the API key stored in the OS keychain for the user's most recently chosen provider. Null if no key is stored yet; [AiComponent.RunInteractive()](https://developer.rhino3d.com/api/gh2/type/grasshopper2.components.descriptive.aicomponent/runinteractive.md) opens the sign-in dialog in that case. Lazy because the field-initialiser form spawned a /usr/bin/security subprocess per AiComponent during document deserialisation on macOS, slowing or hanging the startup file restore.
- [DisplayCapable](https://developer.rhino3d.com/api/gh2/type/grasshopper2.components.descriptive.aicomponent/displaycapable.md)
- [Docs](https://developer.rhino3d.com/api/gh2/type/grasshopper2.components.descriptive.aicomponent/docs.md): Source of Grasshopper2 SDK information the model can consult between turns. Defaults to an in-memory hand-authored corpus; swap for a file-loaded implementation once the content set is big enough to be worth externalising.
- [LastInteractionMessage](https://developer.rhino3d.com/api/gh2/type/grasshopper2.components.descriptive.aicomponent/lastinteractionmessage.md): Message describing the most recent LLM interaction. Null on success; populated with an error/warning when the conversation aborted, the budget was exhausted, an exception escaped, or the user cancelled. Surfaced via [IDataAccess.AddMessage(Message)](https://developer.rhino3d.com/api/gh2/type/grasshopper2.components.idataaccess/addmessage.md) in [AiComponent.Process(IDataAccess)](https://developer.rhino3d.com/api/gh2/type/grasshopper2.components.descriptive.aicomponent/process.md) and persisted across save/load so a deactivated component still explains itself when the document is reopened.
- [Logic](https://developer.rhino3d.com/api/gh2/type/grasshopper2.components.descriptive.aicomponent/logic.md): Gets the component logic.
- [SourceCode](https://developer.rhino3d.com/api/gh2/type/grasshopper2.components.descriptive.aicomponent/sourcecode.md): Gets the C# source code the LLM provided implementing [AiComponentLogic](https://developer.rhino3d.com/api/gh2/type/grasshopper2.components.descriptive.aicomponentlogic.md).
- [Statistics](https://developer.rhino3d.com/api/gh2/type/grasshopper2.components.descriptive.aicomponent/statistics.md): Counters and current phase state for the conversation loop.
- [Transcript](https://developer.rhino3d.com/api/gh2/type/grasshopper2.components.descriptive.aicomponent/transcript.md): Record of every HTTP exchange between this component and an LLM provider during the most recent interaction. This string contains raw JSON values and is not persisted when the file is saved.
- [UserPrompt](https://developer.rhino3d.com/api/gh2/type/grasshopper2.components.descriptive.aicomponent/userprompt.md): Gets prompt the user typed in to generate the component.

## Methods

- [AddInputs](https://developer.rhino3d.com/api/gh2/type/grasshopper2.components.descriptive.aicomponent/addinputs.md)
- [AddOutputs](https://developer.rhino3d.com/api/gh2/type/grasshopper2.components.descriptive.aicomponent/addoutputs.md)
- [AppendToInputPanel](https://developer.rhino3d.com/api/gh2/type/grasshopper2.components.descriptive.aicomponent/appendtoinputpanel.md): Adds an "Account" section to the right-click input panel with a button that opens the active provider's web console (where the user can manage API keys, view usage, and check billing) and a button to forget the stored key.
- [CreateAttributes](https://developer.rhino3d.com/api/gh2/type/grasshopper2.components.descriptive.aicomponent/createattributes.md)
- [PreProcess](https://developer.rhino3d.com/api/gh2/type/grasshopper2.components.descriptive.aicomponent/preprocess.md)
- [Process](https://developer.rhino3d.com/api/gh2/type/grasshopper2.components.descriptive.aicomponent/process.md)
- [RunInteractive](https://developer.rhino3d.com/api/gh2/type/grasshopper2.components.descriptive.aicomponent/runinteractive.md): Entry point invoked on double-click. Shows the prompt dialog, then drives the conversation loop with the configured [AiComponent.Backend](https://developer.rhino3d.com/api/gh2/type/grasshopper2.components.descriptive.aicomponent/backend.md). Errors are surfaced as a message box rather than thrown, since this runs as a fire-and-forget continuation from a UI event. When a previous run is already in flight, the prompt dialog displays a live banner explaining that Send will cancel it. Calling [InteractionStatistics.BeginRun(SolutionId)](https://developer.rhino3d.com/api/gh2/type/grasshopper2.components.descriptive.interactionstatistics/beginrun.md) here trips the prior CancellationToken so the old loop unwinds on its next await; the new run gets a fresh token and id.
- [Store](https://developer.rhino3d.com/api/gh2/type/grasshopper2.components.descriptive.aicomponent/store.md)

## Inherited Members

- From [Component](https://developer.rhino3d.com/api/gh2/type/grasshopper2.components.component.md): [BakeCapable](https://developer.rhino3d.com/api/gh2/type/grasshopper2.components.component/bakecapable.md), [ChildrenObjects](https://developer.rhino3d.com/api/gh2/type/grasshopper2.components.component/childrenobjects.md), [Connectivity](https://developer.rhino3d.com/api/gh2/type/grasshopper2.components.component/connectivity.md), [ConnectivityComplete](https://developer.rhino3d.com/api/gh2/type/grasshopper2.components.component/connectivitycomplete.md), [DisplayParameters](https://developer.rhino3d.com/api/gh2/type/grasshopper2.components.component/displayparameters.md), [IconMode](https://developer.rhino3d.com/api/gh2/type/grasshopper2.components.component/iconmode.md), [Label](https://developer.rhino3d.com/api/gh2/type/grasshopper2.components.component/label.md), [Parameters](https://developer.rhino3d.com/api/gh2/type/grasshopper2.components.component/parameters.md), [Pins](https://developer.rhino3d.com/api/gh2/type/grasshopper2.components.component/pins.md), [SupportsVariableParameters](https://developer.rhino3d.com/api/gh2/type/grasshopper2.components.component/supportsvariableparameters.md), [Threading](https://developer.rhino3d.com/api/gh2/type/grasshopper2.components.component/threading.md), [AppendMetaMixingInput](https://developer.rhino3d.com/api/gh2/type/grasshopper2.components.component/appendmetamixinginput.md), [AppendPinToggles](https://developer.rhino3d.com/api/gh2/type/grasshopper2.components.component/appendpintoggles.md), [BakeShapes](https://developer.rhino3d.com/api/gh2/type/grasshopper2.components.component/bakeshapes.md), [BeforeProcess](https://developer.rhino3d.com/api/gh2/type/grasshopper2.components.component/beforeprocess.md), [CanCreateParameter](https://developer.rhino3d.com/api/gh2/type/grasshopper2.components.component/cancreateparameter.md), [CanRemoveParameter](https://developer.rhino3d.com/api/gh2/type/grasshopper2.components.component/canremoveparameter.md), [ComputeInternal](https://developer.rhino3d.com/api/gh2/type/grasshopper2.components.component/computeinternal.md), [DisplayBounds](https://developer.rhino3d.com/api/gh2/type/grasshopper2.components.component/displaybounds.md), [DisplayFaces](https://developer.rhino3d.com/api/gh2/type/grasshopper2.components.component/displayfaces.md), [DisplayWires](https://developer.rhino3d.com/api/gh2/type/grasshopper2.components.component/displaywires.md), [DoCreateParameter](https://developer.rhino3d.com/api/gh2/type/grasshopper2.components.component/docreateparameter.md), [DoRemoveParameter](https://developer.rhino3d.com/api/gh2/type/grasshopper2.components.component/doremoveparameter.md), [ExpireAllRecipients](https://developer.rhino3d.com/api/gh2/type/grasshopper2.components.component/expireallrecipients.md), [PostProcess](https://developer.rhino3d.com/api/gh2/type/grasshopper2.components.component/postprocess.md), [PostProcessTree](https://developer.rhino3d.com/api/gh2/type/grasshopper2.components.component/postprocesstree.md), [Process](https://developer.rhino3d.com/api/gh2/type/grasshopper2.components.component/process.md), [ResolveIconMode](https://developer.rhino3d.com/api/gh2/type/grasshopper2.components.component/resolveiconmode.md), [VariableParameterMaintenance](https://developer.rhino3d.com/api/gh2/type/grasshopper2.components.component/variableparametermaintenance.md)
- From [ActiveObject](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.activeobject.md): [DisplayCache](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.activeobject/displaycache.md), [State](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.activeobject/state.md), [Compute](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.activeobject/compute.md), [Expire](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.activeobject/expire.md), [PopulateDisplay](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.activeobject/populatedisplay.md), [UpdateDisplay](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.activeobject/updatedisplay.md)
- From [DocumentObject](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.documentobject.md): [Activity](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.documentobject/activity.md), [Attributes](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.documentobject/attributes.md), [CustomValues](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.documentobject/customvalues.md), [Display](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.documentobject/display.md), [DisplayName](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.documentobject/displayname.md), [DisplayStyle](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.documentobject/displaystyle.md), [Document](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.documentobject/document.md), [EntireFamily](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.documentobject/entirefamily.md), [FoundingObject](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.documentobject/foundingobject.md), [Icon](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.documentobject/icon.md), [IconInternal](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.documentobject/iconinternal.md), [InstanceId](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.documentobject/instanceid.md), [Nomen](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.documentobject/nomen.md), [Obsolete](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.documentobject/obsolete.md), [ParentObject](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.documentobject/parentobject.md), [Phase](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.documentobject/phase.md), [ProgressPercentage](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.documentobject/progresspercentage.md), [Relevance](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.documentobject/relevance.md), [Selected](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.documentobject/selected.md), [Selection](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.documentobject/selection.md), [SiblingObjects](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.documentobject/siblingobjects.md), [UserName](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.documentobject/username.md), [ActivityChanged](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.documentobject/activitychanged.md), [AutosaveRequested](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.documentobject/autosaverequested.md), [DisplayChanged](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.documentobject/displaychanged.md), [DocumentChanged](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.documentobject/documentchanged.md), [Expired](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.documentobject/expired.md), [InstanceIdChanged](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.documentobject/instanceidchanged.md), [LayoutChanged](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.documentobject/layoutchanged.md), [NameChanged](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.documentobject/namechanged.md), [RelevanceChanged](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.documentobject/relevancechanged.md), [SelectedChanged](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.documentobject/selectedchanged.md), [AddUndoRecord](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.documentobject/addundorecord.md), [AppendBakeInput](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.documentobject/appendbakeinput.md), [AppendStateInput](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.documentobject/appendstateinput.md), [AppendUserNameInput](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.documentobject/appendusernameinput.md), [ChangeInstanceIds](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.documentobject/changeinstanceids.md), [ExpireDisplay](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.documentobject/expiredisplay.md), [GetCreationInfo](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.documentobject/getcreationinfo.md), [GetModificationInfo](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.documentobject/getmodificationinfo.md), [InvalidateExistingLayout](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.documentobject/invalidateexistinglayout.md), [ModifyIcon](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.documentobject/modifyicon.md), [ModifyNameAndInfo](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.documentobject/modifynameandinfo.md), [OnDisplayChanged](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.documentobject/ondisplaychanged.md), [OnExpired](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.documentobject/onexpired.md), [OnLayoutChanged](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.documentobject/onlayoutchanged.md), [OverrideAttributes](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.documentobject/overrideattributes.md), [RequestAutoSave](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.documentobject/requestautosave.md), [SetCreationInfo](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.documentobject/setcreationinfo.md), [SetModificationInfo](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.documentobject/setmodificationinfo.md), [SetProgressPercentage](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.documentobject/setprogresspercentage.md)
