AI (beta) panel

AI Settings

The provider, endpoint, model and API key Ask AI uses: the Settings window opened on its AI section.

On the ribbonStacked button, AI (beta) panel
NeedsNothing
CommandPYAISETTINGS
ShortcutNone set (bind one in Shortcuts)

What it does#

Opens the ordinary Settings window scrolled to AI assistant (beta). Two providers: Anthropic, and OpenAI-compatible, which covers OpenAI itself, Azure OpenAI, Ollama, LM Studio and most local servers through one base URL. The command is PYAISETTINGS.

How to use it#

  1. Pick the Provider.
  2. Base URL: leave it empty for the provider's public endpoint. For a local or private server choose OpenAI-compatible and give its address ending in /v1, for example http://localhost:11434/v1.
  3. Model: pick from the list or type any model name. Empty means the provider's default (claude-opus-5 for Anthropic, gpt-4o for OpenAI-compatible).
  4. API key: paste it. A local server needs none. When a key is already saved, the box stays empty and the hint names the endpoint it was saved for: leave the box empty to keep it, type a new one to replace it, or press Remove.
  5. Click Test. It sends one tiny request with the values as they stand in the window and reports Connected with the model's reply, or the error.
  6. Longest answer (tokens) caps a reply. The default is 8192.
  7. Click Save. pyACAD offers to reload, because the window also holds every other setting; Ask AI uses the new AI values from its next message either way.

Good to know / limits#

  • The key is stored encrypted for your Windows account in %APPDATA%\pyACAD\secrets.json, never in config.json, so sharing your config never shares the key. A copied secrets.json reads as "no key" on another account or machine.
  • A key belongs to the endpoint it was saved with, and is only ever sent there, over https or to a server on this computer. Change the provider or base URL and you enter that endpoint's key.
  • An OpenAI-compatible base URL other than OpenAI's own is treated as a server that may need no key, so the chat opens without one.
  • Provider, base URL, model and longest answer live in config.json under ai, like every other setting.

Source#

The tool's own files, word for word as shipped in AI_(beta).panel/Setup.stack/AI_Settings.pushbutton. Every pyACAD tool is an ordinary bundle: copy these into your own extension and change what you like.

script.py Runs on a click. View on GitHub
# -*- coding: utf-8 -*-
"""Opens the Settings window scrolled to the AI assistant section.

The section itself is part of Settings, so there is one place where every
pyACAD setting lives. This button is the short way there from the AI panel.
"""

import clr

clr.AddReference('PyAcad.Runtime')
from PyAcad.Runtime.Forms import SettingsDialog

from pyacad import forms, script, toast


def run():
    try:
        outcome = SettingsDialog.ShowAndSave('ai')
    except Exception as error:
        script.get_logger().error('settings not saved: %s' % error)
        toast.error('Could not save your settings', str(error))
        return

    if outcome == SettingsDialog.Outcome.Cancelled:
        return                                  # cancelled: say nothing

    if outcome == SettingsDialog.Outcome.NeedsRestart:
        toast.warning('Settings saved',
                      'The engine paths changed, so AutoCAD needs restarting')
        return

    # The AI keys take effect at the next message with no Reload, but the same
    # window edits everything else too, so offer the Reload the Settings button does.
    if forms.confirm('Reload pyACAD now so the changes show?', 'Settings saved'):
        script.reload_pyacad()
        toast.success('Settings saved', 'pyACAD reloaded, so they show now')
    else:
        toast.success('Settings saved', 'Ask AI uses them from your next message')


if '__commandpath__' in globals():
    run()
bundle.yaml The bundle contract: the keys pyACAD reads for this tool. View on GitHub
title: AI Settings
tooltip: Which provider Ask AI talks to (Anthropic, or any OpenAI-compatible endpoint such as Azure OpenAI or a local server), the model, and your API key. The key is stored encrypted for your Windows account, never in config.json. Opens the Settings window on its AI section.