litellm - 💡(How to fix) Fix [Bug]: Azure Responses API streaming fails with "Unknown parameter: stream_options.include_usage" — blocks Codex usage [3 pull requests]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Error Message

litellm.BadRequestError: AzureException BadRequestError - { "error": { "message": "Unknown parameter: 'stream_options.include_usage'.", "type": "invalid_request_error", "param": "stream_options.include_usage", "code": "unknown_parameter" } }. Received Model Group=azure-gpt-5.5 Available Model Group Fallbacks=None

Root Cause

In our testing, this issue occurs across multiple Azure-deployed models (gpt-5.4, gpt-5.5), not limited to a specific model. Chat Completions API (/v1/chat/completions) with the same Azure models works fine because Chat Completions supports stream_options.

Fix Action

Fixed

Code Example

Unknown parameter: 'stream_options.include_usage'.

---

model_list:
  - model_name: azure-gpt-5.5
    litellm_params:
      model: azure/gpt-5.5
      api_base: https://<your-resource>.openai.azure.com
      api_key: <your-key>
      api_version: 2025-04-01-preview

---

curl -X POST http://localhost:4000/v1/responses \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <key>" \
  -d '{
    "model": "azure-gpt-5.5",
    "input": "Hello",
    "stream": true
  }'

---

{
  "error": {
    "message": "Unknown parameter: 'stream_options.include_usage'.",
    "type": "invalid_request_error",
    "param": "stream_options.include_usage",
    "code": "unknown_parameter"
  }
}

---

litellm.BadRequestError: AzureException BadRequestError - {
  "error": {
    "message": "Unknown parameter: 'stream_options.include_usage'.",
    "type": "invalid_request_error",
    "param": "stream_options.include_usage",
    "code": "unknown_parameter"
  }
}. Received Model Group=azure-gpt-5.5
Available Model Group Fallbacks=None
RAW_BUFFERClick to expand / collapse

Check for existing issues

  • I have searched the existing issues and checked that my issue is not a duplicate.

What happened?

When using OpenAI Codex (or other clients that use the Responses API) with an Azure provider model through LiteLLM proxy, all streaming requests fail with:

Unknown parameter: 'stream_options.include_usage'.

Codex Desktop sends streaming Responses API requests to /v1/responses with stream: true. The client does not include stream_options in the request body (verified by capturing raw Codex requests with a debug HTTP server). However, LiteLLM internally injects stream_options: {"include_usage": true} before forwarding the request to Azure. Azure's Responses API does not accept this parameter (it is only valid for the Chat Completions API), so the request is rejected with HTTP 400.

In our testing, this issue occurs across multiple Azure-deployed models (gpt-5.4, gpt-5.5), not limited to a specific model. Chat Completions API (/v1/chat/completions) with the same Azure models works fine because Chat Completions supports stream_options.

Expected behavior: Codex streaming Responses API requests to Azure models should work. stream_options should not be injected into requests sent to endpoints that do not support it.

Actual behavior: All streaming Responses API requests to Azure models fail with HTTP 400, making Codex unusable with Azure deployments through LiteLLM.

Note: A similar issue was previously reported in #19777 and closed on 2026-01-27, but the underlying issue still exists on the latest main branch as of 2026-05-19.

Steps to Reproduce

  1. Configure a model with Azure provider:
model_list:
  - model_name: azure-gpt-5.5
    litellm_params:
      model: azure/gpt-5.5
      api_base: https://<your-resource>.openai.azure.com
      api_key: <your-key>
      api_version: 2025-04-01-preview
  1. Connect Codex Desktop to the LiteLLM proxy, select the Azure model.

  2. Send any prompt in Codex. Codex sends a streaming Responses API request like:

curl -X POST http://localhost:4000/v1/responses \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <key>" \
  -d '{
    "model": "azure-gpt-5.5",
    "input": "Hello",
    "stream": true
  }'
  1. Observe the error:
{
  "error": {
    "message": "Unknown parameter: 'stream_options.include_usage'.",
    "type": "invalid_request_error",
    "param": "stream_options.include_usage",
    "code": "unknown_parameter"
  }
}
  1. Non-streaming requests work. Chat Completions API with the same model also works.

Relevant log output

litellm.BadRequestError: AzureException BadRequestError - {
  "error": {
    "message": "Unknown parameter: 'stream_options.include_usage'.",
    "type": "invalid_request_error",
    "param": "stream_options.include_usage",
    "code": "unknown_parameter"
  }
}. Received Model Group=azure-gpt-5.5
Available Model Group Fallbacks=None

What part of LiteLLM is this about?

Proxy

What LiteLLM version are you on ?

v1.83.14-stable

Twitter / LinkedIn details

No response

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

litellm - 💡(How to fix) Fix [Bug]: Azure Responses API streaming fails with "Unknown parameter: stream_options.include_usage" — blocks Codex usage [3 pull requests]