[
    {
        "role": "user",
        "content": "why%20does%20microsoft%20ai%20shell%20(aish)%20always%20ask%20for%20azure%20or%20openai%20when%20run%20from%20command%20prompt%3F"
    },
    {
        "role": "assistant",
        "content": "When using Microsoft\u2019s AI Shell (often seen as `aish`), you\u2019ll regularly be prompted for Azure or OpenAI credentials\u2014here\u2019s why, what it means, and how you can configure things to avoid being repeatedly asked.\n\n---\n\n## Why It Keeps Asking\n\n1. **AI Shell requires authentication for model providers**  \n   AI Shell supports various large language model providers\u2014most prominently OpenAI (via the `openai-gpt` agent) and Azure OpenAI or Azure AI Agents. These services don\u2019t allow anonymous use, so the shell needs credentials (API keys, endpoints, deployment names, etc.) to call the LLM endpoints successfully. ([heise.de](https://www.heise.de/en/news/AI-on-the-command-line-Microsoft-releases-AI-Shell-10082697.html?utm_source=openai))\n\n2. **Credential/environment configuration isn\u2019t yet set or is missing**  \n   If required environment variables for OpenAI or Azure OpenAI are not set up, AI Shell has no choice but to prompt you during use. For example, variables like `OPENAI_API_KEY`, or for Azure, things like `AZURE_OPENAI_API_KEY`, `AZURE_OPENAI_ENDPOINT`, and `AZURE_OPENAI_DEPLOYMENT_NAME`. Also, login can be needed for Azure CLI or Azure AD auth. ([leeroopedia.com](https://leeroopedia.com/index.php/Environment%3AMicrosoft_Agent_framework_API_Credentials?utm_source=openai))\n\n3. **Flexibility and dynamic agent selection**  \n   AI Shell supports switching between different agents (e.g. `@openai-gpt`, `@azure` agent) and accommodating different AI providers. Because of that flexibility, it needs to verify credentials for whichever provider you invoke. It can\u2019t assume which one you\u2019ll use and therefore often checks if appropriate configuration is present. ([heise.de](https://www.heise.de/en/news/AI-on-the-command-line-Microsoft-releases-AI-Shell-10082697.html?utm_source=openai))\n\n---\n\n## What \u201cAzure or OpenAI\u201d Credentials It\u2019s Typically Asking For\n\nDepending on which agent/provider you want to use:\n\n- **OpenAI agent**  \n  Needs your OpenAI API key (`OPENAI_API_KEY`) and usually the model ID\u2014e.g. `gpt-4` or `gpt-3.5-turbo`. ([leeroopedia.com](https://leeroopedia.com/index.php/Environment%3AMicrosoft_Agent_framework_API_Credentials?utm_source=openai))\n\n- **Azure OpenAI / Azure AI agents**  \n  Needs an endpoint URL, API key (or Azure AD identity if using keyless auth), and a model or deployment name. If using Foundry or Azure AI Agents, often additional project-level configuration is required. ([github.com](https://github.com/Azure-Samples/azureai-assistant-tool?utm_source=openai))\n\n---\n\n## How to Stop Being Prompted Every Time\n\nYou can permanently configure AI Shell so it doesn\u2019t ask each session. Here\u2019s how to do that:\n\n1. **Set environment variables**  \n   For Windows CMD, PowerShell, or Unix shells:\n\n   - OpenAI example:\n     ```\n     setx OPENAI_API_KEY \"<your-openai-key>\"\n     setx OPENAI_MODEL_ID \"gpt-4o-mini\"   (if needed)\n     ```\n\n   - Azure OpenAI example:\n     ```\n     setx AZURE_OPENAI_API_KEY \"<your-azure-key>\"\n     setx AZURE_OPENAI_ENDPOINT \"https://<resource>.cognitiveservices.azure.com/\"\n     setx AZURE_OPENAI_CHAT_DEPLOYMENT_NAME \"<your-deployment-name>\"\n     ```\n\n   On Linux/macOS, you'd add similar lines to `~/.bashrc`, `~/.zshrc`, etc. ([leeroopedia.com](https://leeroopedia.com/index.php/Environment%3AMicrosoft_Agent_framework_API_Credentials?utm_source=openai))\n\n2. **Login via Azure CLI for Azure AD-based auth**  \n   If your setup supports Azure AD or \u201ckeyless\u201d connections, then logging in with `az login` can allow AI Shell or underlying SDKs to use your Azure identity rather than forcing an API key every time. ([learn.microsoft.com](https://learn.microsoft.com/en-us/azure/developer/ai/keyless-connections?utm_source=openai))\n\n3. **Configure AI Shell agent settings/profile**  \n   Sometimes AI Shell has a `.config` or profile file where you select your default provider/agent and its credentials (or environment variable references). If you set that up, when you invoke `@agent` or default agent, it won\u2019t need to ask again. ([heise.de](https://www.heise.de/en/news/AI-on-the-command-line-Microsoft-releases-AI-Shell-10082697.html?utm_source=openai))\n\n4. **Use Azure OpenAI Keyless Authentication**  \n   For smoother setup and avoiding key prompts, Microsoft provides options to authenticate via Azure Active Directory credentials instead of manually managing API keys. If correctly configured, you might still need endpoint/deployment info, but not always a key. ([learn.microsoft.com](https://learn.microsoft.com/en-us/azure/developer/ai/keyless-connections?utm_source=openai))\n\n---\n\nIf you want, I can walk you through exactly how to set up your system (Windows or Linux/macOS) so that AI Shell has everything it needs ahead of time, and doesn\u2019t prompt again. Do you want the setup for your OS?"
    },
    {
        "role": "user",
        "content": "it%20doesn%27t%20prompt%20for%20credentials%2C%20they%20are%20in%20the%20settings%20already%20but%20it%20does%20prompt%20whether%20to%20use%20azure%20or%20openai%20every%20time.%20my%20OPENAI_API_KEY%20is%20set.%20Is%20there%20a%20command%20line%20switch%20to%20automatically%20choose%20OPENAI%20mode%3F"
    },
    {
        "role": "assistant",
        "content": "I couldn\u2019t find any **official documentation** confirming that Microsoft\u2019s AI Shell (AI Shell / AISH) exposes a command-line flag to *permanently* default to OpenAI (so you\u2019re not asked \u201cAzure or OpenAI?\u201d each run). It\u2019s not clear if such a switch exists. However, there *are* some workarounds and related bits that might help you automate or bypass the prompt.\n\n---\n\n## What I Found & What I Didn\u2019t\n\n- Searches didn\u2019t reveal a publicly documented switch like `--provider openai` or `--default openai` in AISH that suppresses the provider prompt each time.  \n- Most tools with multiple providers allow configuring a default provider *via settings/config files* or environment variables\u2014but I didn\u2019t find this for Microsoft\u2019s AI Shell specifically.\n\nSo currently, the prompt to choose between Azure vs. OpenAI is likely by design when multiple backends are available.\n\n---\n\n## Potential Workarounds to Auto-Choose OpenAI\n\nHere are a few possible solutions or hacks that might help, depending on your environment, permissions, and version of AISH.\n\n| Approach | How It Might Help | What You Need |\n|---|---|---|\n| **Agent config in AISH** | If AISH supports configuring a _default agent_\", you might invoke a command once to set the default to OpenAI. You\u2019d still see it one time. | Try commands like `agent config` or similar; check `aish help` or `aish --help` for anything like `agent` or `provider`. |\n| **Environment variable for provider** | Some tools look at env vars like `AI_PROVIDER`, `AISH_AGENT`, or `AISH_DEFAULT_AGENT` (hypothetical names) to skip provider-choice prompts. | Try looking for such variables in AISH docs or settings; set them in your shell profile if you find one. |\n| **Alias or script wrapper** | Wrap the `aish` command in a script so that every time you run it, it passes something or pre-selects OpenAI via some interactive automation. | If `aish` has a non-interactive mode or can receive stdin that picks \u201cOpenAI\u201d, you could automate that. |\n| **Use version or build that omits Azure** | If your version of AISH includes both agents, you might build a config that only includes OpenAI, so Azure isn\u2019t presented as an option. | Check if there\u2019s a \u201cdisable Azure agent\u201d toggle in settings or a config file. |\n\n---\n\n## What You Should Try Right Now\n\n1. **Look in the local settings/config file** for AISH (maybe in your home directory or under `.config/ai-shell` or similar) for anything about `\"agent\"`, `\"defaultProvider\"`, `\"provider\"`, etc.\n\n2. **Run `aish help` or `aish --help`** to see if there\u2019s a command like `\u2013provider`, `--agent`, `--default-agent`, etc.\n\n3. **Examine environment variables** already set in your shell:  \n   ```bash\n   env | grep -i aish\n   env | grep -i azure\n   env | grep -i openai\n   ```\n   to see if anything suggests how provider selection is being controlled.\n\n4. **Search in your installation folder** for strings like \u201cOpenAI\u201d or \u201cAzure\u201d in configuration schemas/code, to see if there is default behavior.\n\n---\n\nIf you want, I can try to dig through Microsoft\u2019s internal or beta docs (or see if others have already posted this for your exact version of AI Shell), and see if there *is* a hidden flag that works\u2014for example, maybe in the latest preview. Do you want me to check for your specific version of AISH (if you tell me what version you're running)?"
    },
    {
        "role": "user",
        "content": "yes%2C%20how%20to%20set%20default%20in%20agent%20config%3F"
    },
    {
        "role": "assistant",
        "content": "I searched through the official AIShell materials and related resources, but **did not find any documentation** that describes a supported method (config file, command-line flag, environment variable) to permanently select OPENAI by default over Azure\u2014so you still get the choice each time.\n\nHere's a summary of what *did* come up, and some things you can try that might work (or point you in the right direction).\n\n---\n\n## What the Docs Say\n\n- Microsoft\u2019s **AIShell** ships with two agents by default: an `openai-gpt` agent and an `azure` agent. When you start AIShell (for example via `Start-AIShell`), you can switch between agents using `@<agent name>` or issue prompts like `@openai-gpt <message>` to directly use the OpenAI-based agent. ([github.com](https://github.com/PowerShell/AIShell/releases?utm_source=openai))  \n- The changelog for various preview releases (such as v1.0.0-preview.3) indicates refactors around the `openai-gpt` agent and improved support, but it doesn\u2019t show a feature that allows setting one agent as default so the startup prompt (Azure vs. OpenAI) is skipped. ([github.com](https://github.com/PowerShell/AIShell/releases?utm_source=openai))  \n- In the announcement of Preview 3, there are example configurations in a file called `openai.agents.config` with `\"Active\": \"<Name>\"`. This suggests there *is* at least a concept of an \u201cactive\u201d agent among configured OpenAI-compatible agents. But this appears to apply **within** the set of OpenAI-style agents (e.g. third-party OpenAI-compatible models under the `openai-gpt` agent). It doesn\u2019t clearly say it replaces the Azure vs. OpenAI choice. ([devblogs.microsoft.com](https://devblogs.microsoft.com/powershell/ai-shell-preview-2/?utm_source=openai))  \n\n---\n\n## What You Might Try to Set Default to OpenAI\n\nGiven what is known, here are potential workarounds or exploratory steps. Because a feature like this isn\u2019t clearly documented yet, some of these might not work or might require trial.\n\n| Method | What to Try | Notes / Caveats |\n|---|---|---|\n| **Check for \u201cActive\u201d field in `openai.agents.config`** | Explore the file `openai.agents.config` (or its equivalent location, likely under your AIShell user profile or installation folder). If there\u2019s an `\"Active\"` property in it, set that to your preferred OpenAI agent (e.g. `\"openai-gpt\"`). | This may only switch between OpenAI-style providers. It might *not* stop the prompt between Azure vs. OpenAI if AIShell considers those as different classes of agent. |\n| **Inspect AIShell config files for default agent settings** | Search installed AIShell config directories for JSON or other config files referencing `\"DefaultAgent\"`, `\"ActiveAgent\"`, etc.\u2014for example in `~/.aishell/...` or in the AIShell installation folder. | The scope of these configs may be limited to sessions, or only for advanced preview features; may not be stable. |\n| **Command-line switch / alias** | If you use a shell alias or a small script, wrap the `Start-AIShell` or `aish` command so that it invokes with an argument for the OpenAI agent. E.g.:  \n```powershell\naish @openai-gpt\n```  \nor  \n```bash\nalias aish='aish @openai-gpt'\n``` | This is more of a hack, and only helps if AIShell allows agent selection via that kind of inline prefix. |\n| **Check for environment variables** | Sometimes tools use env vars like `AISHELL_DEFAULT_AGENT` or `AISHELL_AGENT` or similar. Setting such a variable might cause AIShell to auto-choose OpenAI. You could try grepping through the AIShell script or executables for \u201cagent\u201d to see if such a name appears. | Could be unsupported; might break if env var names or internals change. |\n\n---\n\n## Recommended Next Step\n\nIf you\u2019d like, I can try to inspect your version of AIShell more deeply. If you send me the *exact version* you have (for example, from `aish --version` or similar), I can see whether in that version there is a hidden or preview feature for default agent selection, or whether there\u2019s an issue/feature request on GitHub that covers it. Do you want me to check that for your version?"
    }
]