Skip to content

Conversation

@bioinfornatics
Copy link

@bioinfornatics bioinfornatics commented Dec 27, 2025

Azure OpenAI Responses API support & auth UX improvements

This PR updates Azure OpenAI support in both the CLI and desktop app to match the Azure portal’s Responses API (including gpt‑5.x models) and makes configuration of authentication and endpoints much easier.

Highlights

  • Works out of the box with Responses API URLs copied directly from the Azure portal.
  • Clear choice between API key and Entra ID authentication for Azure OpenAI, in both CLI and desktop UI.
  • Safer endpoint field behaviour in the desktop app (no more surprise re-population after clearing).
  • Fixes 404 "Resource not found" errors caused by mismatched api-version values.

Backend / CLI

  • Auth mode switch for Azure OpenAI

    • New AZURE_OPENAI_AUTH_TYPE config key with two modes:
      • api_key → sends api-key: <AZURE_OPENAI_API_KEY>
      • entra_id → sends Authorization: Bearer <token from Azure CLI / default credentials>
    • This allows configuring Azure OpenAI either with a static key or with Entra ID, matching the Azure portal’s options.
  • Endpoint and API version handling aligned with the portal

    • AZURE_OPENAI_ENDPOINT now accepts:
      • just the host (https://<resource>.cognitiveservices.azure.com)
      • host + path (…/openai/responses)
      • a full URL copied from the portal (…/openai/responses?api-version=2025-04-01-preview)
    • The value is normalized into:
      • a base endpoint (scheme://host[:port])
      • an optional api-version extracted from the query string.
    • AZURE_OPENAI_API_VERSION is chosen with this priority:
      1. explicit AZURE_OPENAI_API_VERSION in config (if set)
      2. api-version parsed from AZURE_OPENAI_ENDPOINT
      3. default AZURE_DEFAULT_API_VERSION
    • This removes the mismatch where curl with api-version=2025-04-01-preview worked but goose used 2025-04-01 and got 404.
  • Model list / defaults

    • Extends the known Azure models to include gpt-5.1 and related variants.
    • Updates the default API version to the Responses API so new configs work with the latest models by default.

Desktop UI

  • Authentication type dropdown for Azure OpenAI

    • In the provider configuration modal (when provider is azure_openai):
      • Adds an Authentication Type dropdown with:
        • Key AuthenticationAZURE_OPENAI_AUTH_TYPE=api_key
        • Entra ID AuthenticationAZURE_OPENAI_AUTH_TYPE=entra_id
      • When Entra ID is selected, the API key field is hidden; when Key is selected, the field is shown.
    • The chosen auth type is persisted via the config API and used by the backend.
  • “Paste the portal URL” endpoint UX

    • Watches edits to AZURE_OPENAI_ENDPOINT (with a short debounce ~800 ms) and applies:
      • a) Endpoint only (no path, no api-version) → leave as-is.
      • b) Endpoint + path (e.g. …/openai/responses) → rewrite to just the base endpoint; leave AZURE_OPENAI_API_VERSION unchanged.
      • c) Endpoint + path + api-version → rewrite to base endpoint and set AZURE_OPENAI_API_VERSION from the query param.
    • Only applies for the azure_openai provider.
    • Edge cases:
      • If the user clears the field, it stays empty (no auto-repopulation).
      • If the URL is incomplete/invalid while typing, no normalization is performed.
  • Fix for config field re-population

    • Fixes a bug where clearing a field (like the Endpoint) would cause the original server value to reappear.
    • The form now distinguishes:
      • “value explicitly set (including empty string)” vs
      • “no value set yet”,
        and only falls back to the server value in the latter case.

@bioinfornatics bioinfornatics force-pushed the feat-azure-openai-entra-auth-ui branch 2 times, most recently from 8550749 to a8a84b0 Compare December 27, 2025 16:37
@bioinfornatics bioinfornatics changed the title Feat azure OpenAI entra auth UI Feat azure OpenAI API migration to response API + minor UI improvement Dec 27, 2025
@bioinfornatics bioinfornatics requested a review from a team as a code owner December 27, 2025 21:49
@bioinfornatics bioinfornatics force-pushed the feat-azure-openai-entra-auth-ui branch 3 times, most recently from d0d81c9 to a0b2858 Compare December 27, 2025 22:58
Signed-off-by: Jonathan MERCIER <bioinfornatics@gmail.com>
Signed-off-by: Jonathan MERCIER <bioinfornatics@gmail.com>
Signed-off-by: Jonathan MERCIER <bioinfornatics@gmail.com>
Signed-off-by: Jonathan MERCIER <bioinfornatics@gmail.com>
Signed-off-by: Jonathan MERCIER <bioinfornatics@gmail.com>
…t not azure openai

Signed-off-by: Jonathan MERCIER <bioinfornatics@gmail.com>
Signed-off-by: Jonathan MERCIER <bioinfornatics@gmail.com>
Signed-off-by: Jonathan MERCIER <bioinfornatics@gmail.com>
Signed-off-by: Jonathan MERCIER <bioinfornatics@gmail.com>
@bioinfornatics bioinfornatics force-pushed the feat-azure-openai-entra-auth-ui branch from 2bda0db to f204b1e Compare December 30, 2025 00:43
@DOsinga DOsinga requested a review from katzdave January 5, 2026 14:14
/// Configuration key metadata for provider setup
#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
pub struct AuthModeChoice {
/// Valeur stockée dans la configuration (ex: "api_key", "entra_id")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

eh let's keep comments in english if needed at all

label: string;
description?: string | null;
requires_api_key: boolean;
};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a dupe, you should get this from the API

// Ignore parse errors; user may still be typing an incomplete URL or has pasted invalid text.
// We avoid being intrusive in these cases.
}
}, 800); // ~0.8s debounce to allow human typing
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

using a timer for this sort of thing is not the right way to do this. also having three ways of getting this done doesn't make sense to me. pick one.

@DOsinga
Copy link
Collaborator

DOsinga commented Jan 5, 2026

@katzdave can you have a look at this since you looked at the one we did for openai itself? we should make sure to reuse as much code as possible. haven't looked too closely in the auth mode stuff, but left some preliminary comments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants