Skip to content

Azure OpenAI: probe fails on reasoning models (gpt-5.4-mini) - max_completion_tokens=1 always returns HTTP 400 #524

Closed

Description

Summary

The Azure OpenAI provider probe (fetch_via_api) fails permanently on reasoning models such as gpt-5.4-mini because the validation request allots only 1 output token. Reasoning models cannot produce a visible message within that budget, so Azure returns HTTP 400 and the provider card stays red ("Usage unavailable") on every refresh.

Environment

  • Win-CodexBar 0.56.8 (winget, Finesssee.Win-CodexBar), Windows 11 x64
  • Same logic confirmed on main (rust/src/providers/azureopenai.rs)
  • Provider configured via env vars:
    • AZURE_OPENAI_API_KEY (set)
    • AZURE_OPENAI_ENDPOINT=https://<resource>.services.ai.azure.com
    • AZURE_OPENAI_DEPLOYMENT=gpt-5.4-mini
    • AZURE_OPENAI_API_VERSION=v1

Repro / observed behavior

Auth, endpoint, and deployment all validate — the request reaches the model. Azure then returns:

HTTP 400
{ "error": { "message": "Could not finish the message because max_tokens or model output limit was reached. Please try again with higher max_tokens.", "type": "invalid_request_error", "param": null, "code": null } }

Both validation_body() branches fail for this model:

  • v1 branch: max_completion_tokens: 1 → reasoning-model output budget exhausted → HTTP 400 above
  • legacy branch: max_tokens: 1 → rejected outright with "Unsupported parameter: 'max_tokens' is not supported with this model. Use 'max_completion_tokens' instead."

There is no escape hatch on affected resources: this resource only deploys gpt-5.4-mini, so pointing the deployment at a non-reasoning model is not an option (non-reasoning candidates return DeploymentNotFound).

Proof the fix is trivial

Same request with a slightly higher budget succeeds immediately:

POST /openai/v1/chat/completions  { "model": "gpt-5.4-mini", "messages": [{"role":"user","content":"ping"}], "max_completion_tokens": 16 }
→ HTTP 200, finish_reason: stop, model: gpt-5.4-mini-2026-03-17

Suggested fixes (any one suffices)

  1. Raise the probe budget (e.g., max_completion_tokens: 16 / max_tokens: 16).
  2. Treat HTTP 200 with finish_reason: length and empty content as a successful liveness probe — the provider only parses the model field from the response.
  3. Replace the chat-completion probe with a lightweight liveness check (GET /openai/v1/models or similar) — cheaper and model-agnostic.

The provider is a liveness canary only (it reports RateWindow::new(0.0)), so any of these preserve current semantics while making reasoning-only resources usable.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions