OpenAI and Azure OpenAI adapters added alongside existing Claude and Gemini

Commit `16a0799f` adds plain OpenAI and Azure OpenAI to the LLM adapter layer. New files cover streaming, tool-call assembly, deployment discovery, and a fast-model fallback chain that tries the user's pick first, then Gemini Flash Lite, then OpenAI nano, then Claude Haiku, then an AOAI default.

infrastructureintegration

Maintained by Allen Morgan · verified on MikeWatch

The plain OpenAI adapter in lib/llm/openai.ts implements the same StreamChatParams / StreamChatResult interface as the existing Claude and Gemini adapters. Tool calls are assembled from streaming deltas using the same schema upstream's tools expect, so existing tools pass through without changes. The package added is openai@^6.36.0.

The Azure OpenAI adapter in lib/llm/azureOpenai.ts wraps the same OpenAI SDK's AzureOpenAI client. Connection parameters resolve in order: user override, then env vars (AZURE_OPENAI_ENDPOINT, AZURE_OPENAI_API_KEY, AZURE_OPENAI_API_VERSION). The API version defaults to 2024-10-21 if unset. Deployment comes from the model ID's aoai:<deployment> prefix rather than from a single env var - a deliberate design so the user can pick from discovered deployments rather than being locked to one default. The apiKey field is typed optional with a comment indicating Managed Identity auth is a separate ticket.

lib/llm/azureOpenaiDeployments.ts handles deployment discovery and exposes it via GET /llm/azure-openai/deployments in routes/llm.ts.

The fast-model resolver in lib/userSettings.ts walks: user's stored model pick first; if that's unavailable, Gemini Flash Lite; then gpt-4.1-nano; then Claude Haiku; then an AOAI default if configured. The chain is a reasonable resilience pattern independent of the Azure story.

So what The plain OpenAI adapter is the cleanest pull - it's self-contained and straightforward. The AOAI adapter and deployment endpoint matter only if Azure is on your target list. The fast-model fallback chain is a pattern worth considering on its own if you want graceful degradation when a preferred model is unavailable.

View this fork on GitHub →

Spotted something wrong? Or know the PR text has fresher detail than the writeup above?

Commits in this thread

1 commit from Altien/mikeOssAzure, oldest first. Source extracted verbatim from the harvested git log.

SHA Subject Author Date
16a0799f feat(llm): OpenAI + Azure OpenAI providers + global-key fallback chain Allen Morgan 2026-05-08 ↗ GitHub
commit body
Adds OpenAI and Azure OpenAI to the LLM adapter alongside the existing
Claude and Gemini providers, plus the supporting plumbing on the user-
profile and chat sides:

  * lib/llm/openai.ts            - streaming + completion adapter for
                                   plain OpenAI.  Tool-call assembly
                                   matches the upstream OpenAI tool
                                   schema, so Mike's existing tool
                                   surface passes through untouched.

  * lib/llm/azureOpenai.ts        - Azure OpenAI adapter (endpoint +
                                   apiVersion + deployment).  apiKey
                                   is optional so Managed-Identity
                                   auth can land later without an API
                                   change.

  * lib/llm/azureOpenaiDeployments.ts - lists deployments configured
                                   against the user's AOAI resource
                                   for the in-app model picker.

  * lib/llm/types.ts / models.ts  - Provider type now includes
                                   "openai" and "azureOpenai"; AOAI
                                   model ids use the prefix
                                   "aoai:<deployment>" so providerForModel
                                   can route them at runtime.

  * routes/llm.ts                 - GET /llm/azure-openai/deployments
                                   exposes the deployment list to the
                                   frontend model picker.

  * lib/userSettings.ts           - fast_model resolver now walks a
                                   fallback chain: user pick →
                                   Gemini Flash Lite → OpenAI nano →
                                   Claude Haiku → AOAI default
                                   deployment.  AzureOpenaiSettings is
                                   constructed from the persisted
                                   profile columns.

  * routes/{chat,tabular}.ts      - title_model → fast_model.  Title
                                   model name is no longer
                                   provider-coupled.

Adds the openai npm package as a runtime dep.

Capture this thread into my fork

Download a single Markdown prompt that tells Claude how to port every commit above into your working tree — adapting paths and structure to match your repo. Run it via claude -p < capture-thread-192.md from inside the repo you want the changes in.

⬇ Download capture-thread-192.md